Hydrogen is composed of H atom and oxygen is composed of O atom. For water, it is composed by both H and O atom. If you burn hydrogen in oxygen, you can get water. And if you electrolysis water, you can get hydrogen and oxygen.
Mole is mass (g) / Molar mass (mole/gram)
So to find mass in gram multiply the no.mole by Molar mass