I'm not sure what you're asking, but briefly two elements oxygen (or O2, which naturally occurs as two oxygen molecules bonded together, meaning they share electrons) and hydrogen (or H2 which also naturally exists as as two H molecules bonded) are exposed to some sort of energy (heat), which breaks the bond between the two oxygen molecules and the bond between the two hydrogen molecules.
Then one oxygen molecule (which is short two electrons, has 6) starts sharing electrons with two hydrogen molecules (which is short one electron, but shares that electron with oxygen, and oxygen shares an electron with each oxygen)
See here:
https://youtu.be/YIkDac_3pSw?si=2Cg-iFJGE5oYm9hb