The age-old Hebrew and Christian tradition is that Moses, guided by the spirit of God, composed Genesis out of ancient documents existent in his day. The book closes something like 300 years before the days of Moses. Moses could have gotten this information only by direct revelation from God, or through such historical records as had been handed down from his forefathers.
Opening with the creation hymn there are then ten books of Generations which constitute the framework of Genesis. It seems that they were either incorporated bodily by Moses, with such additions and explanations as he may have been guided of God to make; or they were composed by him, under God’s guidance, out of other historical records to which he may have had access.
This is the poetic description, in measured, majestic movement, of the successive steps of creation, cast in the mold of the off-recurring Biblical “seven”. In all literature, scientific or otherwise, there is no sublime account of the origin of things.
Who wrote the creation hymn? Used by Moses, but written, no doubt, long before, perchance by Abraham, or Noah, or Enoch, or Adam. Writing was in common use ages before the days of Moses. This may be the very oldest written document ever made.
How did the writer know about what happened on earth before man appeared? No doubt God “revealed to him the remote past in much the same manner as later the distant future was made known to the prophets.” Who knows but what God may have taught this hymn, or the substance of it, to Adam? And it may have been recited by word of mouth, around the family circle, or sung as a ritual in primitive worship [hymns constituted a large part of the very earliest forms of literature], generation after generation, till finally, under the master hand of Moses, it took its place as the opening utterance of divine book of the ages. If the Bible is God’s word, as we believe it to be, and if God knew from the beginning that he was going to use the Bible as a main instrument in the redemption of man, why should it be difficult to believe that God himself, co-eval with his creation of man, gave to man the germ and nucleus of that word? At least some of God commandments, statues, and laws were in existence in the days of Moses.