Answer
$U(x) = -\frac{G~m_1~m_2}{x}$
Work Step by Step
Since $F(x)$ is attractive, note that $F(x) = -\frac{G~m_1~m_2}{x^2}$
We can find the potential energy function:
$U(x) = -\int~F(x)~dx$
$U(x) = \int~\frac{G~m_1~m_2}{x^2}~dx$
$U(x) = -\frac{G~m_1~m_2}{x}$