The writing of the Old Testament began when Moses wrote the first five books (also known as manuscripts) of the Bible . He performed this task while the children of Israel wandered the wilderness for forty years after the Exodus. Ezekiel and Daniel were written in Babylon. Obadiah was penned in Edom, as was Job. Esther authored the section named after her in Persia. The remaining books were all recorded in the Land of Israel.
The Old Testament underwent five stages or periods of canonization (the process by which a set of manuscripts is considered inspired by God and authoritative). The first stage was under the direction of Moses who, before he died, authorized the first five books of Scripture (Genesis, Exodus, Leviticus, Numbers, and Deuteronomy, see Deuteronomy 31:9, 24 - 26).
The second phase of canonization of O.T. books occurred under the rule of King David and Solomon, who wrote the Psalms, the book of Proverbs and the Song of Solomon. According to "Restoring the Original Bible" by Ernest Martin, chapter 12, "the only reason for adding certain literature to the already existing documents of the Law was the establishment of the permanent Temple . . ."
The third phase occurred under the righteous King Hezekiah of Judah (who ruled from 715 to 686 B.C.). He set out to restore the correct worship of God (2Chronicles 29 - 31), especially at the temple in Jerusalem, after many years of neglect. According to Martin, Hezekiah brought up-to-date the canonical literature used in the restored Temple.
The fourth stage of canonization occurred during the reign of King Josiah, who ruled the Kingdom of Judah from 640 to 609 A.D. The final and greatest phase of canonization of the Old Testament took place under the prophet Ezra and the Great Assembly.
"There is much evidence to indicate that the Canon of the Old Testament was fixed by the about the year 400 B.C. largely as a result of the work of Ezra and Nehemiah and a council of Jews known as the Great Synagogue (Assembly), which met after the return from the Babylonian captivity. Long before that time, however, many of the books we now have in the Old Testament had been agreed upon as inspired" ("Getting Acquainted with the Bible" by Martin Hegland).
Where did they write the New Testament?
The gospels of Matthew, Mark, Luke, most of the gospel of John, the first twelve chapters of Acts, plus the books of James and Jude were recorded in the land of Israel. Luke wrote chapters 13 through 15 of Acts somewhere along the route of Apostle Paul's first missionary journey. He recorded chapters 16 to part of 18 near Corinth, finished 18 to chapter 21 near the region of Ephesus, and then completed his work in the city the Rome.
It was at or near Corinth that the manuscripts for Romans, plus the first and second books of Thessalonians was recorded. Paul created the epistles of 1Timothy and Titus in Nicopolis and the epistle to the Galatians in Syrian Antioch. In the capital city of Rome were recorded the epistles to the Ephesians, Philippians, Colossians, Hebrews, 2Timothy, and Philemon.
It was in the chief city of Asia Minor, Ephesus, that 1, 2 and 3 John, in addition to the two epistles to the Corinthians, were recorded. 1 and 2 Peter was authored in the region of ancient Babylon. The apostle John not only completed his gospel but also recorded the prophetic vision known as Revelation from the island of Patmos, which is located in the Aegean Sea.
Of all the books of the Bible, Job is considered the oldest recorded manuscript. It is believed to have been written around the 1660s B.C. Including Job, nine manuscripts were completed before 1000 B.C. The remaining part of the Old Testament, with the exception of Malachi, was put in a written form between 1000 and 500 B.C. It took a much shorter time to compose the New Testament. From the time of the first manuscript written to papyrus in 35 A.D. (the gospel of Matthew) to the last one completed in 95 A.D. (Revelation) is only sixty years.