I've spent an embarrassingly long time on a seemingly simple homework problem and am starting to believe that either the solution is wrong or that I am a lot stupider than I thought.
The problem is to show that the expression
$$e^{-i(k_2-k_1)x}e^{-i(\epsilon_2-\epsilon_1)t}+e^{i(k_2-k_1)x}e^{i(\epsilon_2-\epsilon_1)t}$$
contains a term which describes completely the time dependence
$$g(x)\cos((\epsilon_2-\epsilon_1)t + \phi)$$
where $g(x)$ is real and $\phi$ does not depend on $x$
It seems to me that generally, the solution relies on the existence of a real function function $g(x)$ and an x-independent $\phi$ such that
$$e^{-if(x)}+e^{if(x)}=g(x)(e^{-i\phi}+e^{i\phi})$$
(Note: $f(x)$ is real)
I cannot think of any $\phi$ satisfying this equation that would be independent of $x$
Assuming $f(x) = (k_2-k_1)x$, what $g(x)$ and $\phi$ would satisfy the equation $$e^{-if(x)}+e^{if(x)}=g(x)(e^{-i\phi}+e^{i\phi})$$ and the constraints that $g(x)$ is real and $\phi$ is independent of $x$ and non-zero?
Any time you see $e^{-if(x)}+e^{if(x)}$, you can replace it with $2\cos\left(f(x)\right)$. So to answer this question as it stood before the unmotivated addition of the "non-zero" condition, you could take $g(x) = \cos\left(f(x)\right)$ and $\phi=0$. But if you really want it to be nonzero, note that since $e^{-i\phi}+e^{i\phi} = 2\cos\phi$, you can quite generally pick any value for $\phi$ as long as $\cos\phi \neq 0$, and then set \begin{equation} g(x) = \frac{\cos\left(f(x)\right)} {\cos\phi}. \end{equation} This is why AccidentalFourierTransform is saying that the problem is ill defined: there's no single answer to it.
Now, looking at your original expression, and remembering that $e^A e^B = e^{A+B}$, we have \begin{align} e^{-i(k_2-k_1)x}e^{-i(\epsilon_2-\epsilon_1)t} + e^{i(k_2-k_1)x} e^{i(\epsilon_2-\epsilon_1)t} &=e^{-i(k_2-k_1)x-i(\epsilon_2-\epsilon_1)t} + e^{i(k_2-k_1)x+i(\epsilon_2-\epsilon_1)t} \\ &=2\cos \left[(k_2-k_1)x+(\epsilon_2-\epsilon_1)t\right] \\ &=2\cos \left[(k_2-k_1)x\right] \cos\left[(\epsilon_2-\epsilon_1)t\right] -2\sin \left[(k_2-k_1)x\right] \sin\left[(\epsilon_2-\epsilon_1)t\right] \end{align} If you're literally asking to show how that expression "contains a term" like $g(x)\cos\left[(\epsilon_2-\epsilon_1)t + \phi\right]$... well just set $\phi=0$ and $g(x) = 2\cos \left[(k_2-k_1)x\right]$. (Remember that a "term" is one part of a sum, whereas a "factor" is one part of a product, so you can see that "term" in the result above.)
EDIT: Given the OP's comments, I think I can rephrase the original question as:
It's not hard to get around the addition of $h(x)$ by simply differentiating both sides of this equation with respect to time. Using the result I showed above, this gives us \begin{equation} -g(x) \sin[(\epsilon_2-\epsilon_1)t + \phi] (\epsilon_2-\epsilon_1) = -2\sin \left[(k_2-k_1)x+(\epsilon_2-\epsilon_1)t\right](\epsilon_2-\epsilon_1), \end{equation} which simplifies to \begin{equation} g(x) \sin[(\epsilon_2-\epsilon_1)t + \phi] = 2\sin \left[(k_2-k_1)x+(\epsilon_2-\epsilon_1)t\right]. \end{equation} Now, this must be true for all values of $t$, so let's just pick two values and see where it leads. First, take $t=0$ and we get \begin{equation} g(x) \sin[\phi] = 2 \sin \left[(k_2-k_1)x\right]. \end{equation} Then, take $t = \pi/[2(\epsilon_2-\epsilon_1)]$ and simplify to find \begin{equation} g(x) \cos[\phi] = 2 \cos \left[(k_2-k_1)x\right]. \end{equation} We can divide the first of these by the second to eliminate $g(x)$ and solve for $\phi$: \begin{equation} \tan\phi = \tan \left[(k_2-k_1)x\right]. \end{equation} So, as you can see, $\phi$ cannot be independent of $x$ unless $k_2=k_1$.