It is NOT written as history. It is inspired by God but written with the understanding and vocabulary of a bronze age shepherd.
“It is NOT written as history.”
Says you with the level of authority that you have.
Parts of Genesis are written as history. Ex: the narratives are historical, the geneologies are historical.
Moses had more than an understanding of a shepherd. "Moses was educated in all the wisdom of the Egyptians and was powerful in speech and action."
Moses had an elite education by the time he was 40.