How did the first life form on Earth know how to reproduce itself?
There is no accepted scientific answer to this question.
If the first life was formed by the accidental arrangement of proteins it would not have a means of reproducing the accidental arrangement of proteins.
If the first life was formed by the accidental arrangement of DNA there would be no proteins to protect the DNA from the environment. Also DNA needs proteins to replicate and reproduce the DNA genome.
The most likely theory is RNA can serve as a genetic code and also codes for some limited proteins. It is unlikely that RNA would be able to code for the formation of membrane proteins and the proteins needed for the reproduction of the RNA. The odds of coming up with the code needed to produce even one protein completely by unguided random accident are greater than all of the atoms acting over all the postulated time in the universe.
Until the first life was able to reproduce itself natural selection as postulated by Darwinian evolution would be unable to "guide" evolution.
So there is no accepted scientific theory that explains how the first life could be able to reproduce itself.