I have to create a CFG which generates
$$\{a^n (ab)^n c^m d^\ell e^k \mid n>0, k, \ell, m\ge0, k<m, m=\ell+k\}$$
The first part is easy enough, I came up with
$$\begin{align*} S &\to aS_2abS_3 \\ S_2 &\to aS_2ab \mid \epsilon \end{align*}$$
However, the second part is very confusing. So far I have
$$S_3 \to S_4 \mid \epsilon$$
The problem I have is how do I possibly keep track of all of these variables? $k$ has to be less than $m$, $m$ has to be equal to $\ell + k$, and $\ell$ must be at least $1$ by extension. Can someone give me some general tips for approaching these CFG's?