I have the following problem:
Let G be a group of order $p^2$ and assume that G is not abelian. I have just shown that $Z(G)$ is cyclic and has order p. Now I want to show that for each element $g\in G\setminus Z(G)$ we have $\operatorname{ord}(g)=p$.
Proof
Let $g\in G\setminus Z(G)$. We remark that $$card(G\setminus Z(G))=card(G)-card(Z(G))=p^2-p=p(p-1)$$Since we know that $\operatorname{ord}(g)\mid card(G)=p(p-1)$ we get that $\operatorname{ord}(g)=\{p,p-1,1\}$. Now let us assume that $\operatorname{ord}(g)=p-1$. Then $g^{p-1}=e$. But this means that $$g^p=g^{p-1}g=eg=g \Rightarrow p=1$$ Which is a contradiction to the assumption that p is prime. Now let us assume that $\operatorname{ord}(g)=1$. Then for all $g\in G\setminus Z(G)$ we have $g^1=g=e$. This means that $G\setminus Z(G)={e}$ which is also a contradiction. Therefore $\operatorname{ord}(g)=p$.
Does this works like this?
The solution is simpler than this. First I'd like to point out (one reason) why your proof is incorrect - it says that $\text{card}(G \setminus Z(G)) = p(p-1)$, and then uses the fact that $\text{card}(G) = p(p-1)$. The order of $G$ is $p^2$.
This logic can still be used. Since the order of $g$ divides $\text{card}(G)=p^2$, we know that the order must be contained in $\{1,p,p^2\}$. If the order is 1, the element is the identity. If the order is $p^2$, then the group is abelian, because it is cyclic. Therefore the order of any non identity element must be $p$. In particular, any element not in the center must have order $p$.