The polymerization reaction is mediated by an enzyme, but the overall reaction is basically an esterification reaction between an alcohol and a phospho acid. The alcohol group is located on the 3end of the sugar of the nucleotide, and the phospho acid group is on the 5 end of the next reacting nucleotide.
Lets say nucleotide 1 will be the first nucleotide. It has a 3` OH on its sugar, and this OH will act as the alcohol group.
Nucleotide 2 has a HOPO3-Sugar-OH linkage (just like nucleotide 1), and the HO part of HOPO3 on nucleotide 2 reacts with the 3` OH on nucleotide 1 and you get an esterification reaction in which a phosphodiester bond is formed
Nuc1-O-P-O3-Nuc2, and now the two nucleotides are linked. This reaction happens over and over and over to make a long single strand chain of DNA or RNA.
In the cell, the HO-PO3-sugar group is actually a triphosphate (HO-PO3-PO3-PO3-sugar), and the extra phosphate groups just provide the needed energy to get the process moving.
Because the genes that make you a human, that allow you to do everything a human can do, including live, are stored in your DNA. And the DNA is converted to RNA to make the gene products of those genes, which are called proteins (usually). DNA and RNA are both nucleic acids (Deoxyribo nucleic Acid....and Ribo nuclei acid).