The best guess that can be made about the Bible is that it is a very self-serving history (of sorts) of the early Hebrew people...a relatively unsophisticated, unknowledgeable, superstitious people who had many enemies in the areas where they lived. Their enemies worshiped barbarous, vengeful, wrathful, unforgiving, demanding, murderous, petty gods. And to protect themselves from those gods, they invented an especially barbarous, vengeful, wrathful, unforgiving, demanding, murderous, petty god...and worshiped it.
The best guess that can be made about the Bible is that it is a necessary mythology.
I can easily understand why the ancient Hebrews felt about it the way they did. The fact that modern theists feel they way they do about it...is disappointing and disheartening.