I have tried to substitute $n$ with $n - 1$ to get $$(n - 1)a_{n - 1} = 2(n - 2) + na_{n - 2}$$ and then combine the two equations to get $$n(a_n - 2a_{n - 1} + a_{n - 2})=2$$ but this didn't lead me anywhere.
I heard there is a method to solve such non-homogenous equations by finding a solution to the homogeneous equation and finding a particular solution to the non-homogeneous one. I know how to solve the homogenous equation, but I don't know how to find a particular solution or don't know this method in detail.
If anyone can help solve this recurrence or recommend a good explanatory source where I can learn how to solve such recurrences, help would be appreciated.