Diatomic applies only to when the element is alone and not bonded to other atoms. So chlorine is Cl2. But other variants of chlorine, including chloride ions (Cl-), chlorine radicals (Cl.), or chlorine compounds (e.g. chloroform CHCl3) are not necessarily diatomic.
So, when you are figuring out the formulas of compounds, you can basically ignore the fact that certain elements are diatomic because that has no effect on them when they form compounds.
Also, you do not need to capitalize the names of elements when written in full. However, you do need to capitalize the symbols of elements correctly (i.e. chlorine is Cl, not cl or CL).