The expression Ep = mgh applies only close to the surface of the Earth. The general expression for the potential energy of a mass m at a distance R from the center of the Earth (of mass me) is Ep = -Gmem/R. Write R = Re + h where Re is the radius of the Earth; show that, when h << Re, this general expression reduces to the special case, and find an expression for g. You will need the expansion (1+x)^-1 = 1 - x + ...