The Torah for modern readers is Genesis, Exodus, Leviticus, Numbers and Deuteronomy. Some arrangements in the past have included Joshua, but that has not been the case for centuries for English readers.
We believe that the Law itself was given by the LORD God on Sinai. God could have added to and edited information Moses already had. Moses was trained in all the learning of the Egyptians and he left Egypt with records of creation, the flood, and the tower of Babel. He also had the records of his own people. He kept records of their wilderness wanderings. And after his death, Joshua added several verses to include his death.
It is possible that Joshua and his assistants made extensive changes to the book of Deuteronomy. It is also possible that the sons of the prophets, the school for formal education in the Law during the monarchy period, edited the Torah. The final edit for the entire Old Testament was made by Ezra after returning from the exile, though these were likely only minor changes.
Reading of the Torah, Aish Synagogue, Tel Aviv, Israel. Photographer Roy Lindman Wikimedia Commons