Whatever Moses wrote in those books, he did by the same Holy Spirit inspiration as all the other prophets of the Lord. There is no way Moses could have known all the things that Genesis, for example, relates except by the leading of the Holy Spirit. He wasn't there at the start of creation or in the Garden of Eden, when Adam and Eve walked with God. Moses lived nearly a thousand years AFTER Abraham walked the earth. Just as the Holy Spirit moved the writers of the New Testament books to write about things they could not have known about personally (i.e., what Jesus prayed in the garden the night He was betrayed), so that same process went on for the writers of the books in the Old Testament. It is because the Holy Spirit was working in these prophets, we can have assurance of the things we are told in Scripture and trust in things God has made known to us through His sacred word.
Amen and again Amen.....and it's not a question..it's 'knowing ' why they were written and given
Just remarking that we ought not forget that Moses was a prince of Egypt, trained to rule in a very sophisticated empire. We can assume that his education included studies in the history of the patriarchs.
One suspects that the great governor Joseph, steward of pharaohs and protector of his kin, probably left some kind of repository of annals of not only his own experiences, but also of the wise men of the Anatolian Urartans, among whom his own father Jacob dwelt for many years.
The tradition over the four hundred and some years survived very likely orally, and not unlikely in written format in the kingdom libraries, which would have constituted a chain-of-eyewitness documentation, a Providentially preserved proto-Bible, waiting for Moses' editorial hand -- just speculatin'.
Perhaps a further purpose would have been to keep the language and writing alive through the residence and growth of the Hebrew peoples in Goshen.
The Bible says that scripture preached to Abraham but the Bible was not written until later. Perhaps we should broaden our definition of Scripture to include Christ. In the beginning was the word. Also it was 430 years from the promise to Abraham to the giving of the law to Moses (Gal 3:17-18).