If |G| = p^{2}, and if every non-identity element has order p, then G cannot be cyclic, or else G would have an element of order p^{2}.

So pick any element a in G of order p, and let H = <a>. Then H is a non-trivial proper subgroup of G. since H is proper, there exists some b in G, but not in H. let K = <b>.

Since G is abelian HK is a subgroup of G. Since p is prime, we have H∩K = {e}, thus |HK| = |H|*|K|/|H∩K| = p*p/1 = p^{2}so that HK = G, that is: G = <a,b>.