Suppose you have a function $h(x)$ which is differentiable, and you consider the function $\mathcal{F}(x) = h(x)f(x)$.
Since $h$ and $f$ are both continuous on $[a,b]$, so is $\mathcal{F}$.
Since $h$ and $f$ are both differentiable on $(a,b)$, so is $\mathcal{F}$.
Since $f(a)=f(b)=0$, then $\mathcal{F}(a)=h(a)f(a)=0$ and $\mathcal{F}(b)=h(b)f(b)=0$, regardless of what $h(x)$ is.
So, $\mathcal{F}$ will also satisfy Rolle's Theorem, and so you know that there exists $c\in (a,b)$ such that $\mathcal{F}'(c)=0$.
Now, what is $\mathcal{F}'(c)$? Well,
$$\mathcal{F}'(x) = h'(x)f(x) + h(x)f'(x).$$
So $\mathcal{F}'(c) = h'(c)f(c) + h(c)f'(c)$. You want $f'(c)=yf(c)$, so you want
$$ 0 = h'(c)f(c) + h(c)f'(c) = h'(c)f(c) + h(c)yf(c) = f(c)\Bigl(h'(c)+yh(c)\Bigr).$$
So either $f(c)=0$, or else $h'(c)+yh(c)=0$. You don't want $f(c)=0$ unless $y=0$, so in general you just want $h'(c)+yh(c)=0$.
How about trying to find some function $h(x)$ such that $h'(x) = -yh(x)$ for all $x$? Then use that for $\mathcal{F}$. Obviously, your choice of $h$ will depend on $y$.