I have encountered this question in a book. I have no clue how to approach the question. How should I go about it? I was thinking of maybe writing m in terms of n, since we have m ≡ 0(mod n).
I tried to contradict it by taking some n which does not divide m. I am not sure if that is the correct procedure
$\impliedby:\;$ If $n|m,$ then $m=nk,$ so $a^m=a^{(nk)}={(a^n)}^k=e^k=e$.
$\implies:\;$ If $a^m=e$ and $n\nmid m$, then $0<\gcd(n,m)<n$ but $a^{\gcd(n,m)}=e,$ (*)
contradicting the assumption that $a$ has order $n$.
Addendum (from my comments, as suggested by Bill Dubuque)
to justify the inequalities and equality on the line marked (*) above:
$0<\gcd(n,m)<n,$ because $n\ne0$ so $0<\gcd(n,m),$ and if $\gcd(n,m)=n$ then we'd have $n|m$.
By Bezout's identity, $\gcd(n,m)=nx+my$, so $a^{\gcd(n,m)}=a^{nx+my}=(a^n)^x(a^m)^y=e^xe^y=e$.