Let $L$ be the linear operator defined by $$L[y]=p(x) \frac{d^2 y}{dx^2}+q(x) \frac{dy}{dx} + r(x) y .$$ Define the adjoint linear operator $\bar{L}$ and hence show that $\overline{\overline{L}}=L$.
What I have already done is I calculated
$$\overline{L}=p(x)\frac{d^2 y}{dx^2}+(2 q'(x)-q(x))\frac{dy}{dx}+(p''(x)-q'(x)+r(x))y$$
When I calculated $\overline{\overline{L}}$ I got
$$\overline{L}=p(x)\frac{d^2 y}{dx^2}+(2p'(x)-2''q(x)+q(x))\frac{dy}{dx}+(2p''(x)-2p'''(x)+r(x))y$$
It was not said in the question to show that if $L$ is a self-adjoint operator then show that $\overline{\overline{L}}=L$. Any ideas?
By definition of the adjoint,
$$\langle L[y], f\rangle = \langle y, \overline{L}[f]\rangle$$
for all appropriate $f$. Then by integration by parts (assuming your functions and their derivatives have the right boundary conditions...)
$$\langle y, \overline{L}[f]\rangle = \left\langle y, \left((-1)^2 \frac{d^2}{dx^2}p(x) - \frac{d}{dx}q(x) + r(x)\right)f\right\rangle.$$
Doing product rules..
$$\overline{L}[f](x) = p''(x) f(x) + 2 p'(x) \frac{d}{dx} f(x) + p(x)\frac{d^2}{dx^2}f(x) - q'(x)f(x) - q(x) \frac{df}{dx} + r(x) f(x). $$
This gives
$$\overline{L}[f](x) = p(x)\frac{d^2}{dx^2}f + (2 p'(x) - q(x)) \frac{df}{dx} + (r(x) - q'(x) + p''(x))f(x).$$
It seems your mistake was in the first derivative term. You should have $2p'(x)$ - not $2q'(x)$. You also have one too many derivatives for $p$ in the last term in $\overline{\overline{L}}$.