$$\frac{d^2 y}{dx^2}-A\frac{dy}{dx}=\cos(y)-B\sin(y)$$
$\frac{dy}{dx}=v(y) \quad \to \quad \frac{d^2 y}{dx^2}= \frac{dv}{dy} \frac{dy}{dx} =\frac{dv}{dy}v(y) $
$$ \frac{dv}{dy}v(y) –A\:v(y)=\cos(y)-B\sin(y)$$
$v(y)=A\:w(y) \quad \to \quad $
$$ \frac{dw}{dy}w(y) –\:w(y)=\frac{\cos(y)-B\sin(y)}{A^2}$$
This is an Abel’s ODE of the second kind. The method of resolution is very complicated. See : http://arxiv.org/ftp/arxiv/papers/1503/1503.05929.pdf
In order to make the symbols more consistent with whose used in the paper, we change the notations : $y=X$ and $w=Y$, so that :
$$ Y(X)\frac{dY}{dX} –Y(X)=Q(X)$$
with $Q(X)=\frac{\cos(X)-B\sin(X)}{A^2}$
The solution (subject to some conditions, see in the paper referenced above) is provided on implicit form :
$$Y(X)^3+p\:Y(X)+q=0$$
where $p$ and $q$ result from the calculus of :
$\psi=X\:Si(X)$ with the special function “Sin integral”
$c= -\frac{\sin(2X)}{4\psi^2} +\frac{\sin^2(X)}{\psi^2}\left(1+\frac{1}{2X} \right) -\frac{1}{\psi}\left( \cos(X)-\frac{\sin(X)}{X} \right)+\frac{\sin^3(X)}{2\psi^3} $
$b=3-c-\frac{4Q(X)}{X+\varphi}$ where $\varphi$ is an arbitrary constant of integration.
$p=-\frac{16}{3}+b$
$q=-\frac{128}{27}+\frac{4}{3}b+c$