ord$(g)|\max\{\text{ord}(g)|g\in G\}$ for all $g\in G$.

Let $ G$ be a finite abelian group and $ n:=\max\{\text{ord}(g)|g\in G\}$ . Now I have to proof that ord$ (g)|n$ for all $ g\in G$ .

My idea was:

Let $ g\in G$ with ord$ (g)=m<n$ . Then because of the euclidean divsion in $ \mathbb{Z}$ one can write $ n=km+r$ for $ k,r\in\mathbb{Z}$ and $ r<m$ . So what I have to show now is $ g^n = g^m = e$ . From that follows $ m|n$ by the definition of ord, right?

So this gives me $ $ g^n=g^{km+r}=g^{km}g^r=(g^m)^kg^r=e^kg^r=g^r$ $

But from here on I dont know where to go next.