Note of caution: I am working in modulo p without explicitly specifying it in some arguments (exponents of elements).
Now, we have two possibilities. If $ G $ has an element of order $ p^2 $, then we are done as this implies that $ G $ is cyclic. Otherwise, $ G $ is nontrivial so all of its elements barring the identity have order $ p $, pick two elements $g_1, g_2 $ in $ G $ with order $ p $ such that $ (g_1) \cap (g_2) = \{e\} $. (Any nontrivial element $ g_2 \notin (g_1) $ will work. To see this, assume that the intersection is nontrivial, then $g_2^a \in (g_1)$ for some $ a \neq 0 $. Now, $ a $ has an inverse mod p, say $ b $, so that $(g_2)^{ab} = g_2 \in (g_1)$, contradicting our initial choice of $g_2$.) Now, assume that $ g_1^a g_2^b = g_1^c g_2^d $, this implies that $ g_1^{a-c} = g_2^{b-d} $. However, the intersection of the cyclic groups was the identity, so we have $ a=c $ and $ b=d $. This implies that as $ a $ and $ b $ run over the congruency classes mod p, $g_1^a g_2^b $ takes $ p^2 $ distinct values, so that it runs over the entire group. To show isomorphism, we need to show that $(g_1^a g_2^b)(g_1^c g_2^d) = g_1^{a+c} g_2^{b+d}$, which follows from the result that groups of order $ p^2 $ are abelian. This implies that $ G \cong (g_1) \times (g_2) $, showing the result.