Consider the function $$f_n(x)=(x^2-1)^n$$..........(20)
Differentiating this equation we get the second order differential equation, $$(1-x^2)f_n''+2(n-1)xf_n'+2nf_n=0$$..................(22)
We wish to differentiate this n times by use of Leibniz's formula, $$\frac{d^n}{dx^n}A(x)B(x)=\sum^n_{k=0}\frac{n!}{k!(n-k)!}\frac{d^kA}{dx^k}\frac{d^{n-k}B}{dx^{n-k}}$$......................(23)
Applying this to (22) we easily get $$(1-x^2)f_n^{(n+2)}-2xf_n^{(n+1)}+n(n+1)f_n^{(n)}=0$$......................................(24)
How to get to (24) from (23)&(22)? This is the source.
$$\frac{d^n}{dx^n}[(1-x^2)f_n''+2(n-1)xf_n'+2nf_n]=0 $$
$$\frac{d^n}{dx^n}[(1-x^2)f_n'']+2(n-1)\frac{d^n}{dx^n}[xf_n']+2nf_n^{(n)}=0 \tag{1}$$
We wish to differentiate this n times by use of Leibniz's formula, $$\frac{d^n}{dx^n}A(x)B(x)=\sum^n_{k=0}\frac{n!}{k!(n-k)!}\frac{d^kA}{dx^k}\frac{d^{n-k}B}{dx^{n-k}} \tag{2}$$
Applying Leibniz's formula to each term in (1) separately
$$\frac{d^n}{dx^n}[(1-x^2)f_n'']=(1-x^2)f_n^{(n+2)}+n(1-x^2)'f_n^{(n+1)}+\frac{n(n-1)}{2}(1-x^2)''f_n^{(n)} $$
$$\frac{d^n}{dx^n}[(1-x^2)f_n'']=(1-x^2)f_n^{(n+2)}-2nxf_n^{(n+1)}-n(n-1)f_n^{(n)} \tag{3}$$
$$\frac{d^n}{dx^n}[xf_n']=xf_n^{(n+1)}+n(x)'f_n^{(n)} $$
$$\frac{d^n}{dx^n}[xf_n']=xf_n^{(n+1)}+nf_n^{(n)} \tag{4}$$
If we put the results (3) and (4) above in (1)
You can get the desired result
$$(1-x^2)f_n^{(n+2)}-2xf_n^{(n+1)}+n(n+1)f_n^{(n)}=0$$