This is Lemma 2 Ch. 11 from : 'Gallian , Contemporary abstract algebra' leading to the fundamental theorem.
Proof: We denote $|G|$ by $p^n$ and induct on $n$. If $n = 1$, then $G = \langle a \rangle \times \langle e \rangle$. Now assume that the statement is true for all Abelian groups of order $p^k$, where $k < n$.
Among all elements of G, choose $a$ of maximum order $p^m$. [Question: Why are we picking any random $m$ for the order of $a$? For Abelian groups, isn't the converse of Lagrange always true? So shouldn't the element a have order $p^{k-1}$?]
The induction hypothesis assumes that the lemma has already been proven for all groups of order $p^k
$. By contrast $p^m$ is the highest order of all the elements of $G$. So the only thing we can say about $m$ is that it must be smaller than or equal to $n$.
Then $x^{p^m} = e$ for all $x$ in $G$. [Question: How, if $|G| = p^k$ ?]
$|G|=p^n$ , not $p^k$ . The orders of all elements are $p^j$ for some $j$ depending on the element. Maximum of these $j$'s is $m$ , by definition.
We can write : $x^{p^m}= (x^{p^j})^{p^{m-j}} = e^{p^{m-j}} =e$
We assume that $G \neq \langle a \rangle$, as there would be nothing left to prove then.
Now among all elements of $G$, choose $b$ of smallest order such does $b \not\in \langle a \rangle$.
We claim that $\langle b \rangle \cap \langle a \rangle = e$
Since $|b^p| = |b|/p$, we know that $b^p \in \langle a \rangle$ by the manner in which $b$ is chosen. [Question: What does he mean by the manner in which $b$ is chosen? Why does $b^p$ lie in the set generated by $a$? Is it because the group with the minimum order has to have order $p$ according to Lagrange and this straightaway implies $b^p = e$ ?]
Let the order of $b$ be $p^j$. This implies : $\frac{|b|}{p}=p^{j-1}$ , also $b^{p^j}=e \implies (b^p)^{p^{j-1}} =e $. If there where $i<j$ for which $(b^p)^{p^{i-1}} =e $ that would contradict the fact that $j$ is the smallest integer for which $b^{p^j}=e$. So $\frac{|b|}{p}=|b^p|$. We chose $b$ to be the element of smallest order not in $\langle a \rangle$. The order of $b^p$ is smaller so it must be in $\langle a \rangle$.
Further in the proof he proves that the order of $b$ must be $p$ and this means $\langle b \rangle \cap \langle a \rangle = \{e\}$.
Consider the factor group $\overline{G} = G/\langle b \rangle$. Let $\overline{x}=x\langle b \rangle$ in $G$.
If $|\overline{a}| < |a| = p^m$, then $\overline{a}^{p^{m-1}} = \overline{e}$. [Question: here we have picked $p^{m-1}$ just as any arbitrary number less than $p^m$, but still a power of $p$, right?]
Right, same argument as above.
By induction, we know that $\overline{G} = \langle \overline a \rangle \times \overline{K}$. [Question: ??? What induction? What is the basis of this step? What even is $K$? How are we even defining $K$ in the steps below?]
The induction hypothesis states that the decomposition into some $ \langle a' \rangle \times K'$ has already been proven for all groups of order $p^k$ less than $p^n$. Now the factor group $\overline{G} = G/\langle b \rangle$ does have order less than $p^n$ , so it can be decomposed this way by the assumption of the induction hypothesis for every $\overline a$ and some $\overline K$.
It now follows from an order argument (???) that $G = \langle a \rangle K$, and therefore $G = \langle a \rangle \times K$.
$\overline K$ consists of cosets of $\langle b \rangle$. The set $K$ is by definition all the elements of $G$ that are in these cosets $ \in \overline K $. So : $|K|=| \overline K| \cdot |\langle b \rangle|$ .
By Lagrange we have : $|G|=|\overline G| \cdot |\langle b \rangle| \implies |G|= |\langle \overline a \rangle | \cdot | \overline K | \cdot |\langle b \rangle|$
( last step is because : $ \overline G = \langle \overline a \rangle \overline K \land \langle \overline a \rangle \cap \langle \overline K \rangle = \{e\} \implies | \overline G|= |\langle \overline a \rangle | \cdot | \overline K | $ )
Because it is also proven above that : $|a|=|\overline a| \implies |\langle a \rangle |=| \langle \overline a \rangle |$ we have : $|G|= |\langle \overline a \rangle | \cdot | \overline K | \cdot |\langle b \rangle| = |\langle \overline a \rangle | \cdot | K | = |\langle a \rangle | \cdot | K | = |\langle a \rangle K |$
( last step because it is proven above that : $ \langle a \rangle \cap \langle K \rangle = \{e\}$ ) .
We have : $|G|=|\langle a \rangle K|$ $ \implies $ $\langle a \rangle K$ contains the same number of elements as $G $ $ \implies $ both sets must be equal.
With this last result we conclude that all the necessary conditions for $ \langle a \rangle \times K $ to be a valid internal direct product are fulfilled .
Best Answer
Your proof is incorrect. You know that $(x^k)^p=e$ (for any $x\in G$), but this does not necessarily mean $x^k$ has order $p$. All it tells you is that the order of $x^k$ divides $p$, so it is either $1$ or $p$.
In fact, your approach cannot work without some major modification. It is possible that $x^k=e$ for all $x\in G$, so there is no element of the form $x^k$ which has order $p$. For instance, if $G=(\mathbb{Z}/p\mathbb{Z})^2$, then $|G|=p^2$ so $k=p$, but $x^p=e$ for all $x\in G$.