What happens when two chlorine atoms are brought together?
There is absolutely no reason why one Cl atom would give an electron to its neighbour, because the two atoms are perfectly equal. Nevertheless, there exists a possibility for the two to acquire a stable structure: In putting together their single electrons, each of them wins a complete octet: Lewis represents a common electron pair by a dash: It is the practice to draw horizontally the dash representing the common electron pair and to call that dash "covalent bond": Now a molecule Cl2 has been formed. There is no more place for a third chlorine atom. The elementary substance chlorine is exclusively constituted of such Cl2 molecules.
What happens when oxygen and hydrogen atoms are brought together?
For getting a complete octet, the oxygen atom needs two hydrogen atoms: Each hydrogen atoms has now the stable electron structure of helium! The electron pairs are represented by dashes: These dashes are usually drawn from one atom to another to represent "covalent bonds". Now the water molecule is finished.
Here is how the ammonia molecule is formed:
The joining of several electron pairs leads to multiple bonds such as in elementary oxygen (double bond): or in elementary nitrogen (triple bond):