In general, the sum of 2 commuting elements squaring to zero in a ring will always cube to zero, but not necessarily square to zero. For example, it can easily be shown that $(x+y)^2 \notin (x^2, y^2)$ in the ring of polynomials in two variables $x$ and $y$ over a field $K$ not of characteristic 2, so the cosets of $x$ and $y$ in the quotient ring $K[x,y]/(x^2, y^2)$ are nilpotents squaring to zero but their sum does not square to zero (although it cubes to zero). However, it is possible for elements squaring to zero in a non-reduced commutative ring to actually form an ideal (e.g. it holds in the ring $\mathbf{Z}/n\mathbf{Z}$ for any positive integer $n$).
Question: Why do the elements in the ring $\mathbf{Z}/n\mathbf{Z}$ squaring to zero form an ideal?
This question is equivalent to asking whether $n \vert x^2$ and $n \vert y^2$ together imply that $n \vert (x+y)^2$, which in turn is equivalent to asking whether the same hypotheses imply that $n \vert 2xy$ (since $2xy=(x+y)^2-x^2-y^2$).
In fact, we can show that $n \vert x^2$ and $n \vert y^2$ together imply that $n \vert xy$ if we know that $\gcd(x^2, y^2)=\gcd(x, y)^2$ (which in fact is always true). Indeed, since $n$ divides both $x^2$ and $y^2$, it also divides $\gcd(x^2, y^2)$, which equals $\gcd(x, y)^2$, but $\gcd(x, y)^2$ in turn divides $xy$, so $n$ also divides $xy$ (and hence $2xy$) by transitivity of divisibility.
If one needs to look up the exact generator of the ideal of elements squaring to zero in $\mathbf{Z}/n\mathbf{Z}$, then one only needs to look up sequence A019554 in the OEIS.
Let $v_p(a)$ be the exponent of $p$ in the prime factorization of $a$.
Then, $ a \mid b$ iff $v_p(a) \le v_p(b)$ for all primes $p$.
Thus, $n \mid x^2$ and $n \mid y^2$ iff $v_p(n) \le 2 v_p(x)$ and $v_p(n) \le 2 v_p(y)$ for all $p$.
Then, $2v_p(n) \le 2 v_p(x) + 2 v_p(y)$, which implies $v_p(n) \le v_p(x) + v_p(y)=v_p(xy)$ for all $p$.
Therefore, $n \mid x^2$ and $n \mid y^2$ imply $n \mid xy$.