It's an amalgamation of ancient mythologies and religious practices, increasingly reflecting the Israelite culture, eventually to be woven into one semi-unified modern belief system. The first five books were written from between two and likely four different authors, and you can see the splicing in the writing today. Some is pretty subtle, like focusing on Moses or Aaron when going to the top of Mount Sinai for the Ten Commandments (three times, lol). Some is pretty humorous in that two different traditions are spliced in the same sentence.
Steve Ebling's, Holy Bible - Best God Damned Version - The Books of Moses: For atheists, agnostics, and fans of religious stupidity (Volume 1) has a great summary of this, as well as a retelling of these stories in all its glorious fantasy.