As you mentioned, the Work-KE Theorem gets you most of the way:
\begin{align}
W_{\rm net} &= \Delta K\\
W_{F_N} + W_{F_g} + W_{F_f} + W_F &= 0\\
0 + -\Delta U_g + W_{F_f} + W_F &=0 \\
&\rightarrow \quad W_F = mgh - W_{F_f}
\end{align}
And, yes, to calculate the work done by friction, you must integrate it along a path using the general definition of work (simpler expressions for work that rely on a straight path, and/or a constant force, do not apply). The general definition of work done by a force vector along a path is:
$$
W_F = \int_{t_i}^{t_f} \vec{F} \cdot \frac{{\rm d} \vec{r}(t)}{{\rm d} t} \, {\rm d} t = \int_{t_i}^{t_f} \vec{F} \cdot \vec{v}(t) \, {\rm d} t
$$
where $\vec{r}(t)$ will be specified as a parameterized path along the hill, such that $\vec{r}(t_i)$ is the starting point and $\vec{r}(t_f)$ is the ending point. There are some immediate simplifications that can be made to this equation. First, we know that the frictional force always points opposite to the velocity, so:
$$
W_{F_f} = \int_{t_i}^{t_f} \vec{F}_f(t) \cdot \vec{v}(t) \, {\rm d} t = \int_{t_i}^{t_f} - F_f(t) \, \left|\vec{v}(t)\right| \, {\rm d} t
$$
Second, we are told that the motion is slow. This implies that we can assume equilibrium at every moment along the path. Therefore, using Newton's Second law, we can find that $F_f = \mu_k F_N = \mu_k F_g \cos\theta$, at a point where the hill is angled at $\theta$ with respect to the horizontal (I'm using $\mu_k$ instead of $k$ because it is more conventional). So we can write:
$$
W_{F_f} = \int_{t_i}^{t_f} - \mu_k \, m\, g \cos \theta(t) \, v(t) \, {\rm d} t
= - \mu_k \, m \, g \, \int_{t_i}^{t_f} \cos \theta(t) \, v(t) \, {\rm d} t
$$
Therefore, if the answer is correct, it must be that:
$$
\int_{t_i}^{t_f} \cos \theta(t) \, v(t)\, {\rm d} t = \ell
$$
What is that integrand? Nothing but the horizontal component of the velocity vector, or,
$$
v(t) \cos \theta(t) = v_x(t)
$$
when we choose the positive $x$ axis to be horizontal and rightward. So, our integral simplifies dramatically:
$$
\int_{t_i}^{t_f} \cos \theta(t) \, v(t) \, {\rm d} t = \int_{t_i}^{t_f} v_x(t) \, {\rm d} t =\int_{t_i}^{t_f} \frac{{\rm d} x}{{\rm d} t} {\rm d} t = \int_{x_i}^{x_f} {\rm d} x
$$
And we see that the answer is indeed correct.