A metal-mediated base pair, composed of two ligand-bearing nucleotides and a bridging metal ion, is one of the most promising components for developing DNA-based functional molecules. We have recently reported an enzymatic method to synthesize hydroxypyridone (H)-type ligand-bearing artificial DNA strands. Terminal deoxynucleotidyl transferase (TdT), a template-independent DNA polymerase, was found to oligomerize H nucleotides to afford ligand-bearing DNAs, which were subsequently hybridized through copper-mediated base pairing (H–CuII–H). In this study, we investigated the effects of a metal cofactor, MgII ion, on the TdT-catalyzed polymerization of H nucleotides. At a high MgII concentration (10 mM), the reaction was halted after several H nucleotides were appended. In contrast, at lower MgII concentrations, H nucleotides were further appended to the H-tailed product to afford longer ligand-bearing DNA strands. An electrophoresis mobility shift assay revealed that the binding affinity of TdT to the H-tailed DNAs depends on the MgII concentration. In the presence of excess MgII ions, TdT did not bind to the H-tailed strands; thus, further elongation was impeded. This is possibly because the interaction with MgII ions caused folding of the H-tailed strands into unfavorable secondary structures. This finding provides an insight into the enzymatic synthesis of longer ligand-bearing DNA strands.