You are very smart! Yes, this is a way to do the problem. However the question that you have to ask is, "the acceleration of what?" What is accelerating here?
One step back: what are our real equations?
Well, we actually have two equations, here I will say that object "1" is the bigger wedge $M$ and object "2" is the smaller wedge $m$ and I will locate them at vector positions $\vec r_1 = [x_1(t), y_1(t)]$ and $\vec r_2 = [x_2(t), y_2(t)].$
There is some complicated constraint force $\vec U_{21} = -\vec U_{12}$ (by Newton's third law!) that keeps the wedge $m$ from passing through the wedge $M$. The rest of the puzzle is these two force equations, the first of which is$$m_1 ~\vec a_1 = \vec F + \vec U_{21} + m_1\vec g + \vec F_N,$$where $\vec F_N = [0, F_N]$ is the normal force that keeps $M$ on the ground and $\vec g = [0, -9.81\text m/\text s^2]$ is the gravitational acceleration. Basically $F_N$ will be whatever it has to be to constrain the y-component $(\vec a_1)_y = 0.$ So actually when we do out the problem the y-component equation is just trivial and we have
$$ m_1 (\vec a_1)_x = |\vec F| - |\vec U_{21}|~\sin\theta,$$where $\theta$ is the angle of inclination of the wedge $M$.
What about the other wedge? It has the equation: $$m_2 ~\vec a_2 = m_2 \vec g + \vec U_{12},$$ and we might actually really care how it moves up/down in space as well as left/right. So you don't get any such simplification. However, and this will be important in a second: since it has to be on this line $y_2 = (x_2 - x_1 - L) ~\tan \theta,$ for some fixed $L$ and $\theta$, you can calculate $y_2$ from $x_1$ and $x_2.$
However remember now Newton's third law, and add these two equations together!$$m_1 ~\vec a_1 + m_2 ~\vec a_2 = \vec F + (m_1 + m_2) \vec g + \vec F_N.$$The complicated constraint force is gone! (I mean, it's not gone gone, it is being balanced on $M$ by $\vec F_N$ so it still has an effect here: but it's an indirect effect, not an explicit effect. The explicit terms are gone.)
Now the question
So now you want to define that there is some acceleration $$(m_1 + m_2) ~\vec a = m_1~\vec a_1 + m_2~\vec a_2$$ and my question is, what is this the acceleration of? If you are writing $\vec a$ then that is $d^2\vec r/dt^2$ and what is the $\vec r$?
And I will answer this question for you: the operator $d/dt$ is what we call a "linear" operator meaning that by standard calculus rules you can derive,
$$ \vec r = \frac{m_1 ~\vec r_1 + m_2 ~\vec r_2}{m_1 + m_2}.$$
In other words it is the acceleration of the center of mass which obeys this equation.
If we similarly to the case for wedge $M$ ignore the $y$-motion of the center of mass, we get simply:$$(m_1 + m_2)~(\vec a)_x = |\vec F|,$$
which is precisely what you intuited. The $x$-component of the center of mass behaves in exactly this way.
Now you just need to figure out either the motion of $x_1,$ or the motion of $x_2$, or the motion of $y_2$, to figure out the rest of the problem.