The composition of the Pentateuch is a kind of battlefield, I would say today. There are many opinions about how the Pentateuch came to be. There are; however, some points on which many scholars agree. One point is that the Pentateuch as such was composed in a late period, in the Persian period. So, it is a building, I would say, not all bricks and the stones came from the Persian period and all the furniture do not come from the Persian period, but the building, as such, was composed late.
There are different stages of course, some elements come from the pre-exilic period, some from later periods. The image I use is the image of a city that was destroyed by an earthquake and rebuilt after an earthquake. The earthquake is the exile. Some buildings survived the earthquake, some did not survive, so some buildings are very old, some are completely new because they were built after the earthquake, and some buildings are mixed buildings, because they reused old elements that were integrated into newer buildings. I would say, with this image we have, perhaps, a way of entering into the world of the Pentateuch and the world of modern scholarship about the Pentateuch.