This relation does not tell that the gravitational potential energy is zero at infinity. For our convenience, we choose the potential energies of the two particles to be zero when the separation between them is infinity. No, if we suppose that the potential energy for $\text{r}=\infty$ is 20J, then we need to modify the formula. Now, potential energy of the two-particle system separated by a distance r is given by
$\text{U}\Big(\text{r'}\Big)=\text{U}\Big(\text{r}\Big)-\text{U}\Big(\infty\Big)$
Given: $\text{U}\Big(\infty\Big)=20\text{J}$$\therefore\text{U}\Big(\text{r}\Big)=-\text{G}\frac{\text{m}_1\text{m}_2}{\text{r}^2}-20$
This formula should be used to calculate the gravitational potential energy at separation r.



