It was a written down collection of oral traditions and laws, so I guess the purpose was to get it all down in one place so people wouldn’t have to keep remembering it and passing it down that way.
It was never written, it was compiled. There’s like double the amount of books but the church cherry picked the books they wanted to include and ignored the ones that went against their world view. I’m the end it was put together for power and control. Even the fact that most people weren’t even allowed to read it, meant that all the “laws of god” were being filtered to you through the church and whatever it was they wanted at the time.
Control.
To record their version of “truth.” There was no distinction between fact and fiction, they were written to establish the “official” history with the political and religious (again, no distinction) agenda they wanted people to follow. The idea that history should involve accurate facts of what actually happened is a relatively new phenomenon in human culture.
Did the people of the time understand that nuance? I honestly don’t know. I assume most of the uneducated masses didn’t, which is why the elites wrote that way.