The authors of the two books of Samuel are not known with certainty. Some attributes them to the prophet Isaiah, while the Pelubert Bible Dictionary refers to different people, including Samuel himself (1Samuel 10:25), Nathan the prophet, Gad or Iddo the seer. Same for the books of Kings. The authors are not known for certainty. Chronicles are traditionally attributed by the Jews to Ezra, and probably correctly so, in spite of modern scholars that believe they were written at a time past Ezra.
Ezra and Nehemiah were written, at least in part, if not mostly, by the same persons. The book of Nehemiah, in particular bears evidence of his own authorship. From the first chapter on he speaks as the narrator of the stories written. Unknown are also the authors of the books of Esther and Job, while the largest portion of Psalms was written by David, and Proverbs by Solomon who also wrote Ecclesiastes and, obviously, the Songs of Solomon.
It goes without saying that the prophets wrote the books bearing their names.
How long did it take to write the Old Testament, from the time the first book was begun to the authoring of its final chapter? The commonly held assumption is that Moses, who wrote the first five books of the Bible (as far as their listing in our modern translations) known as the Pentateuch, was the first to pen words that would be considered scripture. This, however, is not true! Moses wrote his books while the children of Israel wandered the wilderness for forty years, from 1445 to 1405 B.C. Job's book, however, can be dated to the 1660's B.C., at least TWO HUNDRED YEARS before Moses wrote anything! The last Old Testament book was written by Malachi around 400 B.C. This means it took roughly a little more than 1,200 years to write the only "Bible" available to the New Testament church.
For the New Testament books of the Bible, the four gospels were written by the four Evangelists and Acts was written by Luke. The apostle Paul wrote fourteen books or epistles, such as Romans, Galatians, Ephesians, and so on, plus two books each sent to the church at Corinth, the church at Thessalonica, and to his closes friend Timothy. Paul almost certainly also wrote the book of Hebrews, although some scholars would contest his authorship. The remaining first century books were penned by Peter (2), John (4) and one of Jesus' physical brothers named Jude.