Using Maclaurin series to solve $y'=xe^x$. I am trying to solve a differential equation using the Maclaurin series. The differential equation is
$$y'=xe^x$$
My solution 1:
$xe^x$ expressed in sigma notation is: $\sum_{k=0}^\infty\frac{x^{k+1}}{k!}$ and $y'=\sum_{k=0}^\infty(k+1)a_{k+1}x^k$. Equating them will lead to
$$\sum_{k=0}^\infty(k+1)a_{k+1}x^k=\sum_{k=0}^\infty\frac{x^{k+1}}{k!}$$
I was trying to comparing the coefficients, so as to obtain a recurrence relation. But I couldn't do it because the $x$ on both sides of the equation has different exponents ($k$ and $k+1$) respectively.
My solution 2:
I integrate the differential equation to obtain $y=xe^x-e^x+c$ which in sigma notation corresponds to $$y=c+\sum_{k=0}^\infty\frac{x^{k+1}}{k!}-\sum_{k=0}^\infty\frac{x^k}{k!}$$ which can be samplified as
$$y=c+\sum_{k=0}^\infty\frac{x^k(x-1)}{k!}$$
Question:
Am I going in the right direction? In both solutions, I am stuck and am unable to arrive at the textbook solution of
$$y=c+\sum_{k=0}^\infty\frac{x^{k+2}}{(k+2)k!}$$
Thank you in advance.

Method 1:
LHS of the series is given by
$$\begin{aligned} \sum_{k=0}^\infty (k+1)a_{k+1}x^k &= a_1 + \sum_{k=1}^{\infty}(k+1)a_{k+1}x^{k} \\
&= a_1 + \sum_{k=0}^{\infty}(k+2)a_{k+2}x^{k+1}\end{aligned}$$
Note that we have replaced $k$ by $k+1$ in the second equality.
Equality of power series implies that $a_1 = 0$ and
$$(k+2)a_{k+2} = \frac{1}{k!}$$
for all integers $k \geq 0$.
This implies that $a_{k} = \frac{1}{k(k-2)!}$
for $k \geq 2$, and the series solution is given by
$$\begin{aligned} y(x) &= \sum_{k=0}^\infty a_k x^k \\ &= a_0 + \sum_{k=2}^\infty \frac{x^k}{(k-2)!k} \\
 &= a_0 + \sum_{k=0}^\infty \frac{x^{k+2}}{k!(k+2)}. \end{aligned}$$
The sum starts from $k = 2$ since we have the general formula for $k \geq 2$. Furthermore, we have deduced that $a_1 = 0$ and we have no information on $a_0$ (which thus serves as an arbitrary constant to be determined).
Method 2:
Starting from your derived solution, we see that
$$y = C + \sum_{k=0}^\infty \frac{x^{k+1}}{k!} - \sum_{k=0}^\infty \frac{x^{k}}{k!}.$$
In the second summation term, the $k = 0$ term is yet another constant, so we can group it with the $C$ to obtain another arbitrary constant $C'$ and simplify it as follows:
$$\begin{aligned} y &= C' + \sum_{k=0}^\infty \frac{x^{k+1}}{k!} - \sum_{k=1}^\infty \frac{x^{k}}{k!} \\ &=C' + \sum_{k=0}^\infty \left(\frac{1}{k!}- \frac{1}{(k+1)!}\right) x^{k+1}.  \end{aligned}$$
At $k = 0$, note that $k! =  0! = 1 = 1! = (k+1)!$, so the sum starts from 1 instead. We thus have
$$\begin{aligned} y &= C' + \sum_{k=1}^\infty \left(\frac{1}{k!}- \frac{1}{(k+1)!}\right) x^{k+1} \\ &= C' + \sum_{k=0}^\infty \left(\frac{1}{(k+1)!}- \frac{1}{(k+2)!}\right) x^{k+2} \\ &= C' + \sum_{k=0}^\infty \left(\frac{k+2}{(k+2)!}- \frac{1}{(k+2)!}\right) x^{k+2} \\ &= C' + \sum_{k=0}^\infty \left(\frac{k+1}{(k+2)!}\right) x^{k+2}  \\
&= C' + \sum_{k=0}^\infty \left(\frac{k+1}{k!(k+1)(k+2)}\right) x^{k+2} \\
&= C' + \sum_{k=0}^\infty \left(\frac{1}{k!(k+2)}\right) x^{k+2}  \end{aligned}$$
and thus you have the same solution.
