The calculus of the general solution of the Burgers PDE $u_t+u_x u=0$ with the method of characteristics was already shown several times on the forum. Only the initial conditions are different from one case to another.
For example :
Inviscid Burgers' Equation and Implicit Solutions
Find the breaking time in IVP for classical Burgers equation
It isn't necessary to repeat again how one comes to the general solution :
$$u=F(x-ut)$$
where $F$ is any differentiable function.
In the present case, the initial condition is :
$$F(x)=u(x,0) =
\begin{cases}
0, & \text{if } x < 0\\
nx,& \text{if } 0 \leq x \leq \frac{1}{n}\\
1, & \text{if } x > \frac{1}{n}
\end{cases}$$
This determines the function $F$ :
$$F(X)=\begin{cases}
0, & \text{if } X < 0\\
nX,& \text{if } 0 \leq X \leq \frac{1}{n}\\
1, & \text{if } X > \frac{1}{n}
\end{cases}$$
We use a dummy variable $X$ in order to avoid the confusion between $X=x$ if $t=0$ and $X=(x-ut)$ if $t\neq 0$.
Thus, the solution according to the initial condition is :
$$u(x,t) =
\begin{cases}
0, & \text{if } (x-ut) < 0\\
n(x-ut),& \text{if } 0 \leq (x-ut) \leq \frac{1}{n}\\
1, & \text{if } (x-ut) > \frac{1}{n}
\end{cases}$$
This case is very simple because $u=n(x-ut) \quad\to\quad u=\frac{nx}{1+nt}$
$$\begin{cases}
u=0, & \text{if } x < 0\\
u(x,t)=\frac{nx}{1+nt},& \text{if } 0 \leq \frac{x}{1+nt} \leq \frac{1}{n} \quad \text{ i.e. }\quad 0 \leq x \leq \frac{1}{n}+t\\
u=1, & \text{if } \frac{x}{1+nt} > \frac{1}{n} \quad \text{ i.e. }\quad x> \frac{1}{n}+t
\end{cases}$$