slightly related:Is there a specific term for this SDE?
Using $f(x_t, t ) = x_te^{at}$, then $df(x_t,t) = ax_te^{at} + e^{at}dx_t$
We can plug in the original question, $dX_t = aX_tdt + bdW_t$ which results in
$df(x_t,t) = be^{-at}dW_t$ then I get, $x_te^{-at} = \int_0^t{x_te^{-rt}dW_t}$
From here, I am unsure of how to get to $x_t = x_0e^{at}+be^{at}\int_0^t{e^{-at}dW_s}$ which is the final solution.
I also want to use the $x_t$ to find $E[x_t^2]$. I know that $E[x_t] = x_0e^{at}$ but don't know how to to do it when x is squared.
By application of Ito's lemma, we have $$d(e^{-at}X_t)=-a e^{at}X_t dt+e^{at}dX_t+\underbrace{d[e^{at},X_t]}_0 =e^{at}b dW_t$$ thus $$X_t=e^{-at}X_0+b\int_{0}^{t} e^{-a(t-s)}dW_s.$$ As a result $$\text{Var}(X_t)=b^2\text{Var}\left(\int_{0}^{t} e^{-a(t-s)}dW_t\right)=b^2\mathbb{E}\left[\left(\int_{0}^{t} e^{-a(t-s)}dW_s\right)^2\right]$$ By application of Ito's isometry formula, $$\text{Var}(X_t)=b^2\mathbb{E}\left[\int_{0}^{t} e^{-2a(t-s)}ds\right]=b^2\int_{0}^{t} e^{-2a(t-s)}ds=\frac{b^2}{2a}(1-e^{-2at})$$ Finally we have $$\mathbb{E}[X_t^2]=Var(X_t)+\mathbb{E}[X_t]^2$$