The example is given below:
My questions are:
1- I can see that $g_{1} = 1$ when $x \in (1,2),$ $g_{2} = 1$ when $x \in (2,3),$ $g_{3} = 1$ when $x \in (3,4),$ $g_{4} = 1$ when $x \in (3,4)....$
then how $\{g_{n}\}$ converges pointwise to $g = 0$ on $E$?
2- why we exclude $n$ and $n +1$ from the domain of $\chi$? Actually my professor did not exclude the $n$?
could anyone explain this for me, please?
EDIT: for the second question I am just trying to understand how we creat examples.

The sequence $g_n$ "converges pointwise to $g=0$" on $E$ means for each given $x\in E$, $$ \lim_{n\to\infty}g_n(x)=g(x)=0\tag{1} $$
For instance, $\lim_{n\to\infty}g_n(1)=g(1)=0$.
Note that for any fixed real number $x$, $\{g_n(x)\}$ is a sequence of real numbers.
A short answer: it does not matter. It is more or less a matter of taste. You could try using the definition of pointwise convergence to show that (1) remains true for $g_n=\chi_{[n,n+1]}$.