When writing a chemical equation, all the gases are not actually represented in molecular form. There are exceptions. For example Helium, is represented as He itself . This is because Helium atoms are not bonded by any covalant or ionic bonds. But in case of gases like oxygen it cannot exist in monoatomic state so it becomes diatomic to attain stability. That is the reason why gases are represented in molecular form.
This is also the reason of not writing molecular formula for a Metal. In a metal the atoms are not bonded by any ionic or covalent bond. In a covalent bond, 2 atoms share electrons between them and in an ionic bond electrons from one atom is taken by another atom. Hence in gases monoatomic state is very unstable. But in the case of metals, they have a metallic bond between them which is different from the above bonds. In a metallic bond all the atoms release some electrons so that the electrons are free to move and a force of attraction between the negatively charged electrons and positive charged metal ion forms the metallic bond. In this type of bonding 2 atoms are not bonded together and hence the atoms are in monoatomic state.
This is the reason why metals are not represented as molecules in a chemical formula.