In the $2\times 2$ matrices over $\mathbb{Z}$ (or over $\mathbb{Q}$, or over $\mathbb{R}$), the elements $x = \left(\begin{array}{cc} 0 & 1\\ 0 & 0 \end{array}\right)\quad\text{and}\quad y = \left(\begin{array}{cc} 0 & 0\\ 1 & 0 \end{array}\right)$ are nilpotent: $x^2=y^2 = 0$. But $x+y = \left(\begin{array}{cc} 0 & 1\\ 1 & 0 \end{array}\right)$ is not only not nilpotent, it's a unit: $(x+y)^2 = 1$. So the set of nilpotent elements is not a subgroup, hence cannot be an ideal.
In noncommutative rings, you want to consider instead the notion of "nilpotent (left/right/two-sided) ideal": an ideal $I$ for which there exists $k\gt 0$ such that $I^k=0$. The sum of any finite family of nilpotent (left/right/two-sided) ideals is again a nilpotent (left/right/two-sided) ideal. An alternative is to consider "nil ideals", which are ideals in which every element is nilpotent. This is generally the case: when going from the commutative setting to the non-commutative setting, one often switches from "element-wise" to "ideal-wise" conditions. Thus, an ideal $P$ in a non-commutative ring is a prime ideal if for any two ideals $I$ and $J$, if $IJ\subseteq P$ then either $I\subseteq P$ or $J\subseteq P$ (compare to the definition of prime ideal in a commutative setting, which is called a "totally prime" or "completely prime" ideal in the noncommutative setting).