There is a unique ring homomorphism $\mathbb{Z} \to End(G)$

Given an abelian group $G$, let $End(G)$ denote the endomorphism ring of $G$. How can I show that there is a unique ring homomorphism $\mathbb{Z} \to End(G)$. Obviously, the map $n \mapsto g_n$ where $g_n(a) = a^n$ is a ring hom, but why is it unique?

-

A homomorphism of unital rings takes $1$ to $1$. In your case, any homomorphism $\phi:\mathbf Z\to\mathrm{End}(G)$ must thus satisfy $\phi(1)=\mathrm{Id}_G$. Since $1$ is a generator of $(\mathbf Z,+)$, you can see that $\phi$ is automatically unique: $$\phi(n)=\phi(n\cdot1) = \phi(1+\cdots+1) = \phi(1)\cdots\phi(1)=\phi(1)^n=\mathrm{Id}_G^n=g_n.$$
Note that this is not specific to $\mathrm{End}(G)$ in any way. For any unital ring $A$, there is always a unique homomorphism of rings $\mathbf Z\to A$. For a more general version in category theory, see Initial Object.