Let $A$ be a $\mathbb{Z}$-module and suppose that $\mathbb{Z}\oplus \mathbb{Z}\cong \mathbb{Z}\oplus A$. Do we have $\mathbb{Z}\cong A$?
I know the result is true if $A$ is finitely generated as $\mathbb{Z}$-module. Clearly, $A$ can be viewed as a submodule of $\mathbb{Z}\oplus \mathbb{Z}$.
Maybe a submodule of $\mathbb{Z}\oplus \mathbb{Z}$ is finitely generated?
If $\Bbb Z \oplus A$ is finitely generated, then $A$ must be finitely generated. So, it indeed holds that if $\Bbb Z \oplus \Bbb Z \cong \Bbb Z \oplus A$, then $A$ is finitely generated and your previous observation applies. So, $A \cong \Bbb Z$.