mRNA is formed with the help of the codes of the DNA.
Formation of RNA from codes written on DNA is known as transcription, where DNA double helix unzips and unwinds.
Then there are free ribonucleotides which pair up with the complementary bases of one of the exposed DNA strand.
The sugar and phosphate of the neighbouring ribonucleotides keep joining and sugar phosphate backbone of RNA is formed. This pairing up of complementary ribonucleotides along bases of DNA strand is monitored by RNA polymerase , an enzyme.