I have no reason to believe that Moses wrote Genesis. This is a tradition which has been accepted by many believers for a very long time, but as far as I know, there is no evidence, either from the Bible, or from external sources, that Moses wrote Genesis. It is quite possible that he had a role in the transmission of the material we call the Book of Genesis, but we have no information on that.
The internal evidence from Genesis is that it derives from oral traditions that predate Moses. This oral version of Genesis goes all the way back to roughly 2000 BC in Mesopotamia. The cultural material is far more in line with the Mesopotamian world of about 1800 BC than Egypt in around 1400 BC. Exactly when Genesis was written down is not known. It may have been written down hundreds of years before Moses lived, but it is also possible that the oral material was not written down even until after the life of Moses. We simply do not know, and I am not sure that it really matters.
I am guessing that your question still stands, but in a different format. Let me change your question to this: How did the unnamed writers of Genesis know what to write? My answer is that, as with the entire Old Testament, “All Scripture is inspired by God.” (2 Timothy 3:16) And “men spoke from God as they were carried along by the Holy Spirit.” (2 Peter 1:19-21) We do not know exactly how God inspired these writings, but we can be sure that they are inspired because Genesis has every mark of being inspired by God. The evidence Genesis is inspired is voluminous. I suggest you look at and/or listen to the class on Genesis I have taught. I am attaching the notes and ppt, but you can find the audio at my web site. That we do not know who wrote Genesis down, and that we do not know in detail exactly how God inspired this amazing book does not take away from the fact that it is inspired. Did the writer of Genesis use other source material on the life of Abraham, Isaac and Jacob? Perhaps. Was there a proto-version of the Genesis creation account and the flood account that the writer of Genesis used? Probably. I do not know. What I can say is that it was not Moses.
God chooses many different genres to communicate with his people. He uses a lot of poetry. Poetry has the great advantage of being easily remembered, which is important because almost certainly the earliest biblical material was at one time oral in form. God uses straightforward history, proverb, narrative, visions, oracles, letters and many other forms to communicate with us. There is a LOT of metaphor in the Old Testament. Obviously, Psalms are filled with metaphor, but God uses metaphor throughout much of the Old Testament? Why? Because metaphors are a powerful means of explanation. There is not a lot of allegory in the Bible, by the way. There is hardly any allegory in the Bible, but there is much of metaphor, imagery, and all kinds of rhetorical devices in the Bible. These were the most common means of written communication in ancient times, and God used them much in the Bible.