Addition of a nucleotide onto a DNA is an endergonic reaction. In such reactions, the energy is provided by ATP.
ATP is the immediate source of energy for any endergonic reaction occuring in the body. Reactions such as addition of nucleotides are endergonic and anabolic reaction that is, these reactions consume energy which is provided by ATP.