I am not sure how to do this, because when I tried, it showed that $n$ divides $|\phi(g)|$? Let me show you my work so far...
For homomorphism $\phi:G\to H$, show that if $g\in G$ and $|g|=n$, then $|\phi(g)|$ divides $n$.
Let $|g|=n$ and $|\phi(g)|=m$. Then $g^{n}=e_{G}$ and $(\phi(g))^{m}=e_{H}$. Then there exists integers $q,r$ such that $m=nq+r$.
Then $e_{H}=(\phi(g))^{m}=\phi(g^{m})=\phi(g^{nq+r})=\phi(g^{nq})\phi(g^{r})=\phi(e_{G}^{q})\phi(g^{r})=(\phi(g))^{r}$.
Since $m$ is the smallest integer such that $(\phi(g))^{m}=e_{H}$, $r=0$. Then $m=nq$. Then $n$ divides $m$...
Yes, I feel like I am doing this very wrong...
When you write $m=nq+r$, $r<n$ not $m$, so you can have $m=r$, you can write $n=mq+r, r<m$ $\phi(g)^n=\phi(g^n)=e_H=(\phi(g))^{mq}(\phi(g))^r=(\phi(g))^r$ implies that $r=0$ since $m$ is the minimal non zero integer such that $(\phi(g))^m=0$.