use induction on n

for any k<n, if p^k<=|Z(G)|, then Z(G) have a subgroup of order p^k since it is abelian. if p^k>|Z(G)|,then by induction,G/Z(G) must have a subgroup of order p^k/|Z(G)|,by the corresponding theorem, we can write it as H/Z(G), then H will be a subgroup of order p^k