We know that $Z(G)<G,\;$ then $O(Z(G)) \mid O(G). $
If $\;O(Z(G))= p^2, $ then $\;Z(G)=G$ and we are done.
Now, if $O(Z(G))= p,\,$ how can I prove that $G$ is abelian ?
Is it by proving that $G/Z(G)$ is cyclic? And if so, then $G$ is abelian.
If yes how to prove that that $G/Z(G)$ is cyclic?
$o(Z(G))=p$ then $o(G/Z(G))=p$ and every group of prime order is cyclic