From what we know about the Bible’s authors today, the Torah was written by Hebrew scribes in the libraries of Jerusalem under King David.
These were well-educated literary experts who had the traditions of the Israelites, Sumerian cuneiform tablets, possibly Egyptian records. Their attention to polishing their heroes and history legends is also in the tradition of Sumer.
The Hebrew script was new at the time; an adaptation of Arcadian and Phoenician.
The audience for these written histories were sophisticated Hebrews of Jerusalem. They would have know all the literary context that we can only guess at with a lot of archeology and research.
The Hebrews had been a people for almost 1,500 years. The Talmud was the religious law code. This new work, the Torah, was more of a Histories, certainly commissioned by King David. There were certainly other histories that have not survived. This was a particular masterpiece.
The audience would have known full well the cultures of Ur and Babylon, from whence Abraham came.
We know everything from Creation, to Noah and the flood, to the tower of Babel is a retelling of Sumerian mythology. I have read the Epic of Gilgamesh. They use the same traditions and material.
We know that Abraham left Ur with his family’s household deity. Every family in Ur had a personal god to whom they prayed. That personal god was the intermediary to the city god’s who, in turn, were intermediaries to the impersonal, creator deities.
The mystery of Genesis is: did the writer take the fundamentals of Sumerian primeval history: creation and the flood, and merged the impersonal, creator god, Elohim with Abraham’s family god, Yahweh?
In Hebrew, two words are used.
In Genesis 21, we start to see that Yahweh is not exclusive to Abraham any more. In verse 20 “God was with the boy as he grew up.”
The portable family God of Abraham is now spreading. It’s operating independently of the ongoing dialog between Abraham and Yahweh.