How do you integrate $\int \frac{\cos(4x)}{\cos(x)}dx$?
I would suggest that you instead use the cosine’s quadruple-angle formula (which can be derived by applying the double-angle formula twice):
$$\cos(4x)=8\cos^4(x)-8\cos^2(x)+1$$
which would turn your integral into
$$\int \frac{\cos(4x)}{\cos(x)}dx=8\int \cos^3(x)dx-8\int \cos(x)dx+\int \sec(x)dx$$
and you probably know how to evaluate each of these integrals.
Note that$$\cos^2(2x)=\bigl(\cos^2(x)-\sin^2(x)\bigr)^2=\bigl(2\cos^2(x)-1\bigr)^2=4\cos^4(x)-4\cos^2(x)+1$$and that therefore$$\int\frac{\cos^2(2x)}{\cos(x)}\,\mathrm dx=4\int\cos^3(x)\,\mathrm dx-4\int\cos(x)\,\mathrm dx+\int\frac1{\cos(x)}\,\mathrm dx.$$
Hint:
By Werner Formulas
$$\cos(n+2)x+\cos nx=2\cos x\cos(n+1)x$$
For $\cos x\ne0,$
$$\implies\int\dfrac{\cos(n+2)x}{\cos x}\ dx=2\int\cos(n+1)x\ dx-\int\dfrac{\cos nx}{\cos x}\ dx$$
Set $n=2$ and then $n=0$
Finally use Integral of the secant function