SDE:
$$dX_t=\frac{b-X_t}{T-t}dt+dW_t,t<T, \qquad X_0 = a$$
Answer:
Let $b(t)=\frac{-1}{T-t},c(t)=\frac{b}{T-t},\sigma(t)=1$, then $$\begin{align*} X_t&=X_0\exp(\int_{0}^{t}b(s)ds)+\int_{0}^{t}\exp(\int_{s}^{t}b(s)ds)(dW_s+c(s)ds) \\ &=a(1-\frac{t}{T})+\frac{bt}{T}+(T-t)\int_{0}^{t}\frac{dW_s}{T-s} \end{align*}$$
I cannot understand this answer.
Why this transformation occur?
If we want to solve the stochastic differential equation
$$dX_t = \frac{b-X_t}{T-t} \, dt + dW_t \tag{1}$$
it is a good start to consider the corresponding ordinary differential equation
$$dx_t = \frac{b-x_t}{T-t} \, dt, \tag{2}$$
i.e. we solve the "unperturbed" differential equation. It is not difficult to see that the solution of $(2)$ is given by
$$x_t = (T-t) \cdot c + b$$
for a constant $c \in \mathbb{R}$. Now the idea is to use the variation of parameter-approach, i.e. we let $c$ depend on $t$ and $\omega$. Formally, we write
$$Y_t(\omega) := \frac{b-X_t(\omega)}{T-t}.$$
Applying Itô's formula (to $f(t,x) := \frac{b-x}{T-t}$ and the Itô process $(t,X_t)_t$), we find that
$$\begin{align*} Y_t-Y_0 &= -\int_0^t - \frac{1}{T-s} \, dX_s + \int_0^t \frac{b-X_s}{(T-s)^2} \, ds \\ &\stackrel{(1)}{=} - \int_0^t \frac{1}{T-s} \, dW_s. \end{align*}$$
Hence,
$$X_t = - (T-t) \cdot Y_t + b = (T-t) \int_0^t \frac{1}{T-s} \, dW_s + b - (b-a) \frac{T-t}{T}.$$
For the second representation (with the exponential terms), note that $$\int_0^t b(s) \, ds = \ln(T-t) - \ln T.$$ Using this equality, one can easily obtain the corresponding representation.