Nobody has ever been able to determine conclusively how water got here but scientists now are generally agreed on the theory that Earth's water was almost certainly delivered to Earth via comets and asteroids known to originate in these cold but water-filled zones, which were assumed to also be present when our solar system was forming.
One is that comets, asteroids, etc. contained water. When these bodies slammed into the earth, the water was left behind. I personally have many questions about that theory, given all that is known & has been discovered about the universe so far. Another has to do with the order of the periodic table: which gas was first, then underwent a change that produced the next gas, & so on. When enough gases were present, combining began & one product was water, good 'ole' H2O. You will have to find more info that IS available to get the right order etc. I'm a little rusty on details. In fact this order of things was not even taught when I was in school. We just memorized the periodic table as it was in the late 50's & early 60's. My first two children had pretty much the same learning plus some added man made elements. This was in the 80's. But things changed in the 90's. My son was in high school '96 - 2000. He learned the order of the elements..... what was first that produced the next, & what combined to produce the one after that & so on. This info is on the internet.