Hydrogen atom has only one electron and thus has one electron less than the stable insert gas configuration of helium. Therefore, to achieve stable insert gas configuration of helium, it shares its single electron with electron of other hydrogen atom to form a stable diatomic molecule.