There is a mistake that disappears. From $nx=mx$ you conclude $n=m$, which you cannot unless you know $x \
eq 0$. Immediately after, you conclude $x=0$, which is all you use afterward. As others have remarked in the comments, you have to assume $m \
eq n$ or you don't have enough information, then you can conclude $x=0$. Now given your result, the $i^{\text{th}}$ term is $\frac i{mn}$ and the sum of the first $mn$ terms is $\frac {mn(mn+1)}{2mn}=\frac {mn+1}2$ as desired.