$\newcommand{\bl}[1]{\boldsymbol{#1}}
\newcommand{\e}{\bl=}
\newcommand{\p}{\bl+}
\newcommand{\m}{\bl-}
\newcommand{\mb}[1]{\mathbf {#1}}
\newcommand{\mc}[1]{\mathcal {#1}}
\newcommand{\mr}[1]{\mathrm {#1}}
\newcommand{\mf}[1]{\mathfrak{#1}}
\newcommand{\gr}{\bl>}
\newcommand{\les}{\bl<}
\newcommand{\greq}{\bl\ge}
\newcommand{\leseq}{\bl\le}
\newcommand{\il}[1]{$\:#1\:$}
\newcommand{\plr}[1]{\left(#1\right)}
\newcommand{\blr}[1]{\left[#1\right]}
\newcommand{\clr}[1]{\left\{#1\right\}}
\newcommand{\vlr}[1]{\left\vert#1\right\vert}
\newcommand{\Vlr}[1]{\left\Vert#1\right\Vert}
\newcommand{\lara}[1]{\left\langle#1\right\rangle}
\newcommand{\lav}[1]{\left\langle#1\right|}
\newcommand{\vra}[1]{\left|#1\right\rangle}
\newcommand{\lavra}[2]{\left\langle#1|#2\right\rangle}
\newcommand{\lavvra}[3]{\left\langle#1\right|#2\left|#3\right\rangle}
\newcommand{\vp}{\vphantom{\dfrac{a}{b}}}
\newcommand{\Vp}[1]{\vphantom{#1}}
\newcommand{\hp}[1]{\hphantom{#1}}
\newcommand{\tl}[1]{\tag{#1}\label{#1}}$
The differential equation to be solved is
\begin{equation}
\dfrac{\mr dy}{\mr dx} \e \dfrac{E_y\plr{x,y}}{E_x\plr{x,y}}
\tl{01}
\end{equation}
By a first glance it seems to be difficult or may be impossible to succeed separation of the used variables $\:\plr{x,y}$. This equation was solved by an accidentally successful change of variables. The new variables are
\begin{equation}
u \e \tan\theta_{\mr A} \,,\qquad v \e \tan\theta_{\mr B}
\tl{02}
\end{equation}
where $\:\plr{\theta_{\mr A},\theta_{\mr B}}\:$ the angles shown in Figure-01.
Using the geometry of the problem we'll transform the differential equation \eqref{01} with respect to $\:\plr{x,y}\:$ to a differential equation with respect to $\:\plr{ u, v}$. The new differential equation is separable and we note a priori that its solution yields the result
\begin{equation}
\cos\theta_{\mr A} \m \cos\theta_{\mr B} \e \texttt{constant}
\nonumber
\end{equation}
as OP mentioned in his post.
At first from the geometry of the problem we have
\begin{equation}
\plr{x \m a}\tan\theta_{\mr B} \e y \e \plr{x \p a}\tan\theta_{\mr A}
\nonumber
\end{equation}
or
\begin{equation}
\plr{x \m a} v \e y \e \plr{x \p a} u
\tl{03}
\end{equation}
so
\begin{equation}
x \e \dfrac{\tan\theta_{\mr B}\p\tan\theta_{\mr A}}{\tan\theta_{\mr B}\m\tan\theta_{\mr A}}\, a \,,\qquad y \e \dfrac{2\tan\theta_{\mr B} \tan\theta_{\mr A}}{\tan\theta_{\mr B} \m \tan\theta_{\mr A}}\, a
\tl{04}
\end{equation}
or
\begin{equation}
x \e \plr{\dfrac{v\p u}{v\m u}} a \,,\qquad y \e \plr{\dfrac{2\,v\, u}{v \m u}} a
\tl{05}
\end{equation}
From \eqref{05}
\begin{equation}
\mr dx \e 2\,\dfrac{v\mr du\m u\mr d v}{\plr{v\m u}^2}\, a \,,\qquad \mr dy \e 2\,\dfrac{v^2\mr du\m u^2\mr d v}{\plr{v\m u}^2}\, a
\tl{06}
\end{equation}
From \eqref{06} the left hand side of \eqref{01} is transformed as follows
\begin{equation}
\dfrac{\mr dy}{\mr dx} \e \dfrac{v^2\mr du\m u^2\mr d v}{v\mr du\m u\mr d v}
\tl{07}
\end{equation}
For the transformation of the right hand side of \eqref{01} we have at first
\begin{align}
E_x & \e kq\plr{\dfrac{x \m a}{\mr{PB}^3} \m \dfrac{x \p a}{\mr{PA}^3}}
\tl{08a}\\
E_y & \e kq\plr{\hp{x}\dfrac{y}{\mr{PB}^3}\: \m \hp{x}\dfrac{y}{\mr{PA}^3}\:\Vp{\dfrac{x \m a}{\mr{PB}^3}}}
\tl{08b}
\end{align}
so
\begin{equation}
\dfrac{E_y}{E_x} \e \dfrac{\plr{\dfrac{1}{\mr{PB}^3} \m \dfrac{1}{\mr{PA}^3}}y}{\plr{\dfrac{1}{\mr{PB}^3} \m \dfrac{1}{\mr{PA}^3}}x \m \plr{\dfrac{1}{\mr{PB}^3} \p \dfrac{1}{\mr{PA}^3}}a}
\tl{09}
\end{equation}
From the geometry of the problem
\begin{equation}
\mr{PA} \e \dfrac{y}{\sin\theta_{\mr A}} \,,\qquad \mr{PB} \e \dfrac{y}{\sin\theta_{\mr B}}
\tl{10}
\end{equation}
and \eqref{09} yields
\begin{equation}
\dfrac{E_y}{E_x} \e \dfrac{\plr{\sin^3\theta_{\mr B} \m \sin^3\theta_{\mr A}}y}{\plr{\sin^3\theta_{\mr B} \m \sin^3\theta_{\mr A}}x \m \plr{\sin^3\theta_{\mr B} \p \sin^3\theta_{\mr A}}a}
\tl{11}
\end{equation}
Replacing $\:x,y\:$ by their expressions \eqref{04} in terms of
$\:\tan\theta_{\mr A},\tan\theta_{\mr B}\:$ we have
\begin{equation}
\dfrac{E_y}{E_x} \e \dfrac{\sin^3\theta_{\mr B} \m \sin^3\theta_{\mr A}}{\sin^2\theta_{\mr B}\cos\theta_{\mr B} \m \sin^2\theta_{\mr A}\cos\theta_{\mr A}}
\tl{12}
\end{equation}
Expressing the trigonometric functions $\:\sin\theta_{\mr A},\cos\theta_{\mr A}\:$ and $\:\sin\theta_{\mr B},\cos\theta_{\mr B}\:$ in terms of the new variables $\:\tan\theta_{\mr A} \e u\:$ and $\:\tan\theta_{\mr B} \e v\:$ respectively, that is
\begin{align}
\!\!\!\!\!\!\!\!\!\!\!\!\sin\theta_{\mr A} & \e \dfrac{\varepsilon_{\mr A}\tan\theta_{\mr A}}{\sqrt{1\p\tan^2\theta_{\mr A}}}\e \dfrac{\varepsilon_{\mr A}u}{\sqrt{1\p u^2}}\,, \quad \cos\theta_{\mr A} \e \dfrac{\varepsilon_{\mr A}}{\sqrt{1\p\tan^2\theta_{\mr A}}}\e \dfrac{\varepsilon_{\mr A}}{\sqrt{1\p u^2}}
\tl{13a}\\
\!\!\!\!\!\!\!\!\!\!\!\! &\nonumber\\
\!\!\!\!\!\!\!\!\!\!\!\!\sin\theta_{\mr B} & \e \dfrac{\varepsilon_{\mr B}\tan\theta_{\mr B}}{\sqrt{1\p\tan^2\theta_{\mr B}}}\e \dfrac{\varepsilon_{\mr B}v}{\sqrt{1\p v^2}}\,, \quad \cos\theta_{\mr B} \e \dfrac{\varepsilon_{\mr B}}{\sqrt{1\p\tan^2\theta_{\mr B}}}\e \dfrac{\varepsilon_{\mr B}}{\sqrt{1\p v^2}}
\tl{13b}\\
\!\!\!\!\!\!\!\!\!\!\!\! &\nonumber\\
\!\!\!\!\!\!\!\!\!\!\!\!\varepsilon_{\mr A} & \e
\left.
\begin{cases}
\p 1, \quad \texttt{if } \theta_{\mr A}\bl\in \blr{0,\pi/2}\\
\m 1, \quad \texttt{if } \theta_{\mr A}\bl\in \blr{\pi/2, \pi}
\end{cases}
\right\}\,,\quad
\varepsilon_{\mr B} \e
\left.
\begin{cases}
\p 1, \quad \texttt{if } \theta_{\mr B}\bl\in \blr{0,\pi/2}\\
\m 1, \quad \texttt{if } \theta_{\mr B}\bl\in \blr{\pi/2, \pi}
\end{cases}
\right\}
\tl{13c}
\end{align}
equation \eqref{12} yields
\begin{equation}
\dfrac{E_y}{E_x} \e \dfrac{\varepsilon_{\mr B}\plr{1\p u^2}^\frac32 v^3 \m \varepsilon_{\mr A}\plr{1\p v^2}^\frac32 u^3}{\varepsilon_{\mr B}\plr{1\p u^2}^\frac32 v^2 \m \varepsilon_{\mr A}\plr{1\p v^2}^\frac32 u^2}
\tl{14}
\end{equation}
Combining \eqref{01}, \eqref{07} and \eqref{14} we have the differential equation in terms of the new variables $\:u,v$
\begin{equation}
\dfrac{v^2\mr du\m u^2\mr d v}{v\mr du\m u\mr d v}\e \dfrac{\varepsilon_{\mr B}\plr{1\p u^2}^\frac32 v^3 \m \varepsilon_{\mr A}\plr{1\p v^2}^\frac32 u^3}{\varepsilon_{\mr B}\plr{1\p u^2}^\frac32 v^2 \m \varepsilon_{\mr A}\plr{1\p v^2}^\frac32 u^2}
\tl{15}
\end{equation}
or
\begin{equation}
\varepsilon_{\mr A}\dfrac{u\,\mr du}{\plr{1\p u^2}^\frac32} \e \varepsilon_{\mr B}\dfrac{v\,\mr dv}{\plr{1\p v^2}^\frac32}
\tl{16}
\end{equation}
that is
\begin{equation}
\varepsilon_{\mr A}\dfrac{\mr d\plr{1\p u^2}}{\plr{1\p u^2}^\frac32} \e \varepsilon_{\mr B}\dfrac{\mr d\plr{1\p v^2}}{\plr{1\p v^2}^\frac32}
\tl{17}
\end{equation}
which integrated gives the solution
\begin{equation}
\dfrac{\varepsilon_{\mr A}}{\sqrt{1\p u^2}} \e \dfrac{\varepsilon_{\mr B}}{\sqrt{1\p v^2}}\p \texttt{constant}
\tl{18}
\end{equation}
that is
\begin{equation}
\cos\theta_{\mr A} \m \cos\theta_{\mr B} \e \texttt{constant}
\tl{19}
\end{equation}

To find the $\:\texttt{constant}\:$ we refer to Figure-02. For $\:\theta_{\mr B} \e \pi\:$ we have $\:\theta_{\mr A} \e \theta\:$ where $\:\theta\:$ the angle with respect to the $\:\mr{Ox}\m$axis of the tangent to the curve at point charge $\:\m q$. That is
\begin{equation}
\cos\theta_{\mr A} \m \cos\theta_{\mr B} \e \cos\theta \m \cos\pi \bl\implies
\nonumber
\end{equation}
\begin{equation}
\boxed{\:\:\cos\theta_{\mr A} \m \cos\theta_{\mr B} \e 1 \p \cos\theta\:\:\vp}
\tl{20}
\end{equation}
To give the parametric equations of this curve we make use of equations \eqref{04}
\begin{align}
x_\theta\plr{\theta_{\mr A}} & \e \dfrac{\tan\theta_{\mr B}\p\tan\theta_{\mr A}}{\tan\theta_{\mr B}\m\tan\theta_{\mr A}}\, a
\tl{21a}\\
y_\theta\plr{\theta_{\mr A}} & \e \dfrac{2\tan\theta_{\mr B} \tan\theta_{\mr A}}{\tan\theta_{\mr B} \m \tan\theta_{\mr A}}\, a
\tl{21b}
\end{align}
In above equation we replace the angle $\:\theta_{\mr B}\:$ as function of the angle $\:\theta_{\mr A}\:$
according to \eqref{20}
\begin{equation}
\theta_{\mr B} \e \arccos\plr{\cos\theta_{\mr A}\m 1\m\cos\theta}
\tl{22}
\end{equation}
so the $\:{\color{red}{\bl{\theta_{\mr A}}}}\m$parametric equations for the $\:{\color{blue}{\bl{\theta}}}\m$parameter electric field line
\begin{align}
x_{\color{blue}{\bl\theta}}\plr{{\color{red}{\bl{\theta_{\mr A}}}}} & \e \dfrac{\tan\blr{\arccos\plr{\cos{\color{red}{\bl{\theta_{\mr A}}}}\m 1\m\cos{\color{blue}{\bl\theta}}\Vp{\tfrac{a}{b}}}\vp}\p\tan{\color{red}{\bl{\theta_{\mr A}}}}}{\tan\blr{\arccos\plr{\cos{\color{red}{\bl{\theta_{\mr A}}}}\m 1\m\cos{\color{blue}{\bl\theta}}\Vp{\tfrac{a}{b}}}\vp}\m\tan{\color{red}{\bl{\theta_{\mr A}}}}}\, a
\tl{23a}\\
y_{\color{blue}{\bl\theta}}\plr{{\color{red}{\bl{\theta_{\mr A}}}}} & \e \dfrac{2\tan\blr{\arccos\plr{\cos{\color{red}{\bl{\theta_{\mr A}}}}\m 1\m\cos{\color{blue}{\bl\theta}}\Vp{\tfrac{a}{b}}}\vp}\tan{\color{red}{\bl{\theta_{\mr A}}}}}{\tan\blr{\arccos\plr{\cos{\color{red}{\bl{\theta_{\mr A}}}}\m 1\m\cos{\color{blue}{\bl\theta}}\Vp{\tfrac{a}{b}}}\vp}\m\tan{\color{red}{\bl{\theta_{\mr A}}}}}\, a
\tl{23b}\\
\vp{\color{red}{\bl{\theta_{\mr A}}}} & \bl\in \blr{0,{\color{blue}{\bl\theta}}}\,, \qquad {\color{blue}{\bl\theta}}\bl\in \blr{0,\pi}
\tl{23c}
\end{align}
The electric field line for $\:{\color{blue}{\bl\theta}} \e 2\pi/3\:$ is shown in Figure-02.

Building the electric field line of Figure-02 (video).
