Fundamental theorem of finite abelian groups proof 
Can someone give a proof of the "technical part" of the following proof? 

One direction seems pretty trivial, but the other I am having trouble with. Why does it matter that the subgroup $H$ we choose is maximal?
 A: I'm not sure whether this approach works, but you can try it:
Suppose $\left\langle g\right\rangle H\neq G$. Then there exists an $x\in G\setminus \left\langle g\right\rangle H$. Let $H'$ denote the smallest subgroup of $G$ containing $H$ and $x$. By maximality of $H$, $H'\cap \left\langle g\right\rangle\neq \left\{e\right\}$. Hence there exists a non-trivial $y\in G$ such that $y\in H'\cap \left\langle g\right\rangle$. Since $G$ is commutative, this implies that we can write $y=hx^i$ for some $h\in H$ and some $i\neq 0$ (otherwise $y\in H\cap \left\langle g\right\rangle=\left\{e\right\}$), and $y=g^n$ for some $n$. Hence $g^n=hx^i$ and thus $x^i=g^nh^{-1}\in \left\langle g\right\rangle H$. 
Can you conclude from this that $x\in \left\langle g\right\rangle H$? That would yield a contradiction.
Edit: Here is a another try: Notice that $\left\langle g\right\rangle\cap H=\left\{e\right\}$. Now consider $G/H$.For each $x\in G$ we denote by $\bar{x}$ the corresponding class in $G/H$. We claim that $|\bar{g}|=|g|=p^m$ (here $|x|$ is the order of an element). Suppose that $|\bar{g}|<p^m$. Then $\bar{g}^{p^{m-1}}=\bar{e}$, hence $g^{p^{m-1}}\in H$. But then $g^{p^{m-1}}\in \left\langle g\right\rangle\cap H=\left\{e\right\}$ contradicts the fact that $|g|=p^m$. Thus $|\bar{g}|=p^m$. It follows that the order of $\bar{g}$ is maximal in $G/H$.
By the induction hypothesis $G/H\cong \mathbb{Z}_{p^m}\times K$ where $K$ is a product of cyclic groups. Now consider the subgroup $L:=\left\{x\in G\mid \bar{x}\in K\right\}$. Then $|L|=p^i|K|$ for some $i$, in fact $|L|=|H||K|$ (Why?). Suppose that $x\in \left\langle g\right\rangle\cap L$, then $\bar{x}\in \left\langle \bar{g}\right\rangle\cap K=\left\{\bar{e}\right\}$ (Why?), and thus $x\in H$, hence $x\in \left\langle g\right\rangle\cap H=\left\{e\right\}$. We just proved that $\left\langle g\right\rangle\cap L=\left\{e\right\}$.
Thus $|\left\langle g\right\rangle L|=|\left\langle g\right\rangle||L|=p^i(|\left\langle \bar{g}\right\rangle||K|)=|H||G/H|=|G|$. By maximality of $H$ we definitely need that $|\left\langle g\right\rangle H|=|G|$ which then shows the claim.
