Jesus said that Moses wrote Genesis.
But how did Moses get the information? By revelation?
It seems that much of the information may have been available to Moses in written form.
Mention is made in Genesis 5:1 of "the book of the generations of Adam". This document included genealogies and perhaps some pertinent accompanying narrative.
Mention is also made in the book of Genesis of "the generations of the heavens and the earth". It was the story of creation and subsequent events.
These documents might have been available to Moses, handed-down through Jacob, Issac, Abraham, Noah and Enoch. The name Enoch means 'scribe' in some languages.
Some of the information might also have been handed-down orally. And this information would have been entirely reliable, when you consider that Adam lived long enough to make it possible that Enoch could have known Adam personally. In fact, all of Adam's descendants before Enoch outlived Enoch, for Enoch was taken. So Enoch may have met them all!
Noah was Enoch's grandson, and Noah could have known all of Adam's descendants in that family line - because they all lived so long.
Then after the flood, Noah was still alive up until the time when Abraham reached the age of 60. In fact, Noah's son Shem outlived Abraham! So Abraham could have met Noah or at least Shem. Even if he didn't meet them, the fact they were still alive meant that they could have denied it if the stories being told about them were not true.
Then Abraham begat Isaac, and Isaac Jacob, and Jacob Levi, and Levi's great-grandson was Moses.
So you can see how few hands and mouths the written and oral information had to pass through before reaching from Adam to Moses. Not too many at all!
Moses' role, therefore, under the inspiration of the Holy Spirit, was simply to compile the written documents and oral information into a single book, the book of Genesis.
Much of the information which Moses put into the book of Genesis would have been information which was already widely known by all Israelites and not just Israelites but by many of the inhabitants of the whole world.