Express the maximum work from a voltaic cell
There is a simpler approach to this problem.

First, since both initial concentrations are not 1 M, you need to determine $E$ for the initial conditions, where $Q$ is the reaction quotient $Q=\frac{[\ce{Mg^{2+}}]}{[\ce{Ag^{+}}]^2}$:

$$E=E^\circ-\dfrac{RT}{nF}\ln{Q}$$

The value of $n$ for this reaction is $n=2$, and assuming $T=298\ \mathrm{K}$:

$$E_i=3.17\ \mathrm(V)-\dfrac{(8.314 \dfrac{\text{J}}{\text{K}\cdot \text{mol}})(298 \text{ K})}{(2)(9.648\times10^4 \dfrac{\text{C}}{\text{mol}})}\cdot\ln{\dfrac{0.1 \text{ M}}{(1.0 \text{ M})^2}}=3.22 \text{ V}$$

You can then go and convert this potential into free energy or maximum work or whatever else you want. 

At equilbrium $E=0$ and $Q=K_c$, so we can calculate the equilibrium constant if we want to compare it to $Q$ and determine which direction is favored. We don't need to. Since $E_i&gt;0$, this reaction procedures toward the products.

Now, as the reaction proceeds the concentrations of $\ce{Ag+}$ and $\ce{Mg^{2+}}$ will change. From the law of mass action:

$$-\Delta \ce{[Ag+]}= 2\Delta \ce{[Mg^{2+}]}$$

After some time $\Delta \ce{[Ag+]} = 0.25 \text{ M}$, so $\Delta \ce{[Mg^{2+}]}=0.125\text{ M}$ and $[\ce{Ag+}]=0.75 \text{ M}$ and $[\ce{Mg{2+}}]=0.225 \text{ M}$. The value of $Q$ has changed and so has the value of $E$:

$$E_i=3.17\ \mathrm(V)-\dfrac{(8.314 \dfrac{\text{J}}{\text{K}\cdot \text{mol}})(298 \text{ V})}{(2)(9.648\times10^4 \dfrac{\text{C}}{\text{mol}})}\cdot\ln{\dfrac{0.225 \text{ M}}{(0.75 \text{ M})^2}}=3.18 \text{ V}$$

As the reaction proceeds, the value of $E$ decreases, which means the amount of work that can be done by the reaction also decreases. The maximum value of $E$ occurs at the initial state, and so the maximum work that this cell can do happens at the initial state. Since $E$ decreases as the reaction proceeds, so too does the work the cell can do at any moment.

If you want the total work, then you need to integrate with respect to $Q$, not worrying about the actual concentrations:

$$\int_{Q_i}^{K_c}E\cdot\mathrm{d}Q$$