The formation of water from it's elements produces, in addition to water, a tremendous amount of energy, 572 kJ to be exact.
2H2 + O2 2H2O + ENERGY
This is an example of an exothermic reaction, a reaction that produces energy. It is also an example of what is called a combustion reaction, where a substance (in this case hydrogen gas) is combined with oxygen

According to Shell's theorem, If a particle of mass m is located outside a spherical shell of mass M at, for instance, point P, the shell attracts the particle as though the mass of the shell were concentrated at its centre. Thus, as far as the gravitational force acting on a particle outside the shell is concerned, a spherical shell acts no differently from the solid spherical distributions of mass.