If $\displaystyle \bigoplus_{i=1}^{n} \mathbb{Z} \cong \bigoplus_{i=1}^{m} \mathbb{Z}$ as groups, then $n=m.$
Here is my proof:
Let $G$ be a group such that $\varphi:G \rightarrow \displaystyle \bigoplus_{i=1}^{n} \mathbb{Z}$ is a isomorphism, consider the subgroup of $2G:=G+G$ then, define $2\varphi:2G \rightarrow \displaystyle \bigoplus_{i=1}^{n} \mathbb{2Z}$, such that $2\varphi(x):=\varphi (x)+\varphi (x), $ is a isomorphism, then $G/2G \cong \displaystyle \bigoplus_{i=1}^{n} \mathbb{Z_2}$, thus, $|G/2G|=2^n$.
Finally, if $\displaystyle \bigoplus_{i=1}^{n} \mathbb{Z} \cong G\cong \displaystyle \bigoplus_{i=1}^{m} \mathbb{Z}$.
$2^m=|G/2G|=2^n$, we conclude that $n=m$.
Is my proof ok?
The idea of your proof is fine, but there are some issues. (Contrary to the comments, it is not "OK".)
The main issue is with your function $2\varphi: 2G\rightarrow\bigoplus_{i=1}^{n} \mathbb{2Z}$, which you define by $2\varphi(x):= x+x$. Two issues:
Three other, more minor comments:
\displaystylein your MathJax, as it can look weird. Instead, either put it on its own line, via$$...$$, or leave it as it is. For example, in the above I have used $\bigoplus_{i=1}^{n}$ "inline", but if I had put a\displaystyleinfront, e.g. $\displaystyle\bigoplus_{i=1}^{n}$, it is distracting because it messes with spacing between lines (I've hopefully made my point but and just typing to add text to emphasise the line spacing issue).