If you define the vector r as:
[tex]\vec{r} = \vec{P_1} - \vec{P_2}[/tex]
With length:
[tex]r = \left| \vec{P_1} - \vec{P_2} \right|[/tex]
Then your vector equation for the force becomes:
[tex]\vec{F} = \frac{G m_1 m_2 \, \vec{r}}{r^3}[/tex]
Then finally you have to think about the direction of the force. The direction of the gravitational force is along the vector r. It has the same direction as the vector r. You can also see that in the equation.
Because the direction of the force should have nothing to do with it's magnitude, you have to normalize the vector r:
[tex]\vec{e_r} = \frac{\vec{r}}{|\vec{r}|} = \frac{\vec{r}}{r}[/tex]
This is often called the unit vector in the direction of r. The length of this vector is 1, because we have divided the vector r by it's length (hence the name unit vector).
Then finally, plugging this into the equation, we get:
[tex]\vec{F} = \frac{G m_1 m_2}{r^2} \frac{\vec{r}}{r} = \frac{G m_1 m_2}{r^2} \vec{e_r}[/tex]
Which is simply the magnitude of the force (the first equation on your paper), pointing in the direction of r. To get the very last equation, you simply take P1 to be the origin, which is point (0,0,0) in three dimensions, or (0,0) in two dimensions. In each case, the vector P1 is now the zero vector. So:
[tex]\vec{P_1} - \vec{p} = \vec{O} - \vec{p} = -\vec{p}[/tex]
And because you take the magnitude of the vector, the minus sign does not matter.