If g is the acceleration due to gravity on the earth's surface, the gain in the potential energy of an object of mass m raised from the surface of the earth to a height equal to the radius R of the earth is
The gravitational potential energy of the body on earth's surface
At a height h from the earth's surface
Therefore, gain in potential energy