Question: the function $$a\_{n+2}=3a\_{n+1}-2a\_n+2$$
is given, and $$a\_0=a\_1=1, (a\_n)\_{n\ge0}$$
multiplying everything by $$/\sum\_{n=0}^\infty x^{n+2}$$
also adding $$\sum\_{n=0}^\infty (a\_{n+2}x^{n+2}+a\_1x+a\_0)-a\_1x-a\_0=\sum\_{n=0}^\infty (3a\_{n+1}x^{n+2}+a\_0)-a\_0-\sum\_{n=0}^\infty 2a\_nx^{n+2}+\sum\_{n=0}^\infty 2x^{n+2}$$
we get $$R(X)-2x-1=3x(R(X)-1)-2x^2R(X)+\frac{2x^2}{1-x}$$
$$R(X)(1-3x+2x^2)+x-1=\frac{2x^2}{1-x}$$
$$R(X)(1-3x+2x^2)=\frac{3x^2-2x+1}{1-x}$$
$$R(X)=\frac{3x^2-2x+1}{(1-x)^2(1-2x)}=\frac{A}{(1-x)^2}+\frac{B}{1-2x}$$
so $$3x^2-2x+1=A(1-2x)+B(1-x)^2$$
$$3x^2-2x+1=x^2(B)+x(-2A-2B)+A+B$$
B=3  

-2A-2B=-2  

A+B=1$$\quad\Longrightarrow\quad A=-2, B=3$$
$$R(X)=\frac{-2}{(1-x)^2}+\frac{3}{1-2x}=-2\sum\_{n=0}^\infty nx^{n-1}+3\sum\_{n=0}^\infty (2x)^2=$$
how to proceed?

Answer: 
The generating function I'm getting is:

$
\begin{align}
R(x) &= \dfrac{1-3\, x+4\, x^2}{1-4\, x+5\, x^2-2\, x^3}\\
 &= \dfrac{2}{1-2 \, x} + \dfrac{1}{1-x} - \dfrac{2}{{\left(1-x\right)}^{2}}\\
 &= \sum\_{n\ge 0} \left(2^{n+1}-2\, n-1\right)\, x^n
\end{align}
$
$a\_{n+2}=3a\_{n+1}-2a\_n+2$, $a\_0=a\_1=1$

Doing it the more pedestrian way, you would first find the basis solutions of the homogeneous equation that are geometric progressions, $a\_n=q^n$. This is the case if
$$
q^2=3q-2\iff 0=(q-1)(q-2), 
$$
so that the general homogeneous solution is
$$
a\_n=C+D\,2^n
$$ 
Since the inhomogeneity is also a constant, the ansatz of similar type is $a\_n=A\,n$, resulting in the equation
$$
A(n+2)=3A(n+1)-2An+2\iff -A=2\iff A=-2
$$
so that the general solution of the inhomogeneous recursion has the form
$$
a\_n=-2n+C+D\,2^n
$$
Checking the initial conditions gives
$$
1=C+D=-2+C+2D\iff 0=-2+D\land C=-D+1\iff D=2\land C=-1
$$
so finally
$$
a\_n=-(2n+1)+2^{n+1}.
$$