Is range $(T- \lambda I )$ is invariant under $T$? In order to prove following theorem

Suppose $V$ is a finite-dimensional complex vector space and $T \in \mathbb L (V)$. Then $T$ has an upper-triangular matrix with respect to some basis of $V$.

my textbook states that range $(T- \lambda I )$ is invariant under $T$, for an eigenvalue $\lambda$.
It gives following proof, but this fact disagrees with the counter example I give below. Can someone point out where is the flaw in my understanding?

Suppose $u \in U=Range(T-\lambda I)$. Then
$Tu=(T-\lambda I)u+ \lambda u$ . Obviously first component $\in U$ (because U equals the range of $T-\lambda I$) and second component $\in U$.
Thus the equation above shows that $Tu \in  U$. Hence U is invariant under T, as claimed.

My counter example :
Consider $T$ as a projection of $R^2$ on $x$-axis. $T(x,y)=(x,0)$. For any vector parallel to $x$-axis, i.e. of the form $(x,0)$,  $T(x,0)=(x,0)$. So $\lambda = 1$ is an eigenvalue of $T$, and the corresponding eigen vectors are in $x$-axis.
So range of $U=Range(T-\lambda I)$ are all vectors in $R^2$ except the $x$-axis. But for any vector in $u\in Range(T-\lambda I),Tu$ is of the form $(x,0)$, and in $x$-axis. So  $Tu \not \in Range(T-\lambda I)$. So $U=Range(T-\lambda I)$ is not invariant under $T$.
EDIT:
Could you please also verify if following are correct, for my example?
Range $T$ = $x$-axis
Null $T$ = $y$-axis
Range $(T-\lambda I)$ = $y$-axis
Null $(T-\lambda I)$ = $x$-axis
If this is true, then Range $(T-\lambda I)$ will be invariant under $T$ as $T(0,y)=(0,0)\in Range (T-\lambda I)$
 A: Yes, $\text{range}(T-\lambda I)$ is invariant under $T$. Here's a quick proof, assuming we're in a finite-dimensional vector space $V$ and $T:V\to V$ is a linear map.
Suppose $v\in \text{range}(T-\lambda I)$. Then, $v = (T-\lambda I) w$ for some $w\in V$. What is $Tv$?
$$Tv = T(T-\lambda I)w = T^2w - \lambda Tw = (T-\lambda I)(Tw) = (T-\lambda I)w'$$
where $w' = Tw$. Clearly, $(T-\lambda I)w' \in \text{range}(T-\lambda I)$. So, $Tv \in \text{range}(T-\lambda I)$. This works for arbitrary $v\in \text{range}(T-\lambda I)$, so $\text{range}(T-\lambda I)$ is invariant under $T$.
In other words, we have shown that
$$T (\text{range}(T-\lambda I)) \subseteq \text{range}(T-\lambda I)$$
which is exactly how one should proceed to prove $T$-invariance of a subspace.

Some words about your particular counterexample: You've correctly identified $\lambda = 1$. Let's find $\text{range}(T-\lambda I)$ for you. Consider some $(x,y)\in\Bbb R^2$.
$$(T-\lambda I)(x,y) = T(x,y) - (x,y) = (x,0) - (x,y) = (0,-y)$$ i.e. the range consists of vectors on the $Y$ axis .
You also want to find $\ker(T-\lambda I)$, so let's see how that works. If $(x,y) \in \ker(T-\lambda I)$, then $$(T-\lambda I)(x,y) = (0,0) \implies (x,0) - (x,y) = (0,0) \implies y = 0$$
i.e. precisely those vectors which are on the $X$-axis.
I leave it to you to find $\text{range}\ T$ and $\ker T$.
