Given that the matrix is
\begin{bmatrix} 1 & -1 & 2 & 0\\ 0 & 1 & -1& 1\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0\\ \end{bmatrix}
thus the null-space of $U$ is any vector $x= [X_1,X_2,X_3,X_4]^T$ that satisfies the two equations:
$X_1-X_2+2X_3 = 0$
$X_2-X_3+X_4 = 0$
"Observe that the null space will have dimension 2, and thus its basis will have two linearly independent vectors."
How can we observe that the null space will have dimension 2?
also the given solutions is $a_1=[-2,0,1,1]^T$, $a_2=[-1,1,1,0]^T$
How can we observe that the null space will have dimension 2?
Note that your matrix is row reduced echelon form with pivots in the first and second column. Thus, the third and fourth variables are free to take any values and you'll correspondingly get the values for $x_1$ and $x_2$.
The last two columns being pivotless implies that the dimension of the null space is $2$.
Note that if you do want to get a basis of the null space, you can do by producing two linearly independent vectors in the null space. As observed earlier, $x_1$ and $x_2$ are completely determined by $x_3$ and $x_4$. (Moreover, we have no restrictions on $x_3$ and $x_4$.)
Thus, one way to produce two such vectors is by substituting $(x_3, x_4) = (0, 1)$ and $(x_3, x_4) = (1, 0)$.
In the solution you've stated, they've used $(x_3, x_4) = (1, 1)$ and $(x_3, x_4) = (1, 0)$.