Answer
The force disappears at $x = \frac{L}{1+\sqrt{2}}$.
The plot of the force is shown in the figure.
Work Step by Step
Let the body of mass $M$ be at the position $x$. The mass $m$ is at $x=0$ and the mass $2m$ is at $x=L$. The force on the mass $M$ can be written as follows for the three regions $x\le0$, $0< x\le L$, and $x> L$.
\[ F = \begin{cases}
\frac{GMm}{x^2}+\frac{2GMm}{(L-x)^2} & x\leq 0 \\
-\frac{GMm}{x^2}+\frac{2GMm}{(L-x)^2} & 0\leq x\leq L \\
-\frac{GMm}{x^2}-\frac{2GMm}{(x-L)^2} & x>L
\end{cases}
\]
The net gravitational force is 0 only in the region $0\le x$