The NT affirms the Holy Spirit’s involvement in the writing of Scripture during the economy of the Old Covenant. God’s prophets were men of the Spirit, who determined the nature of their ministry and their words.
They made their hearts like a rock so as not to obey the law or the words that the LORD of Hosts had sent by His Spirit through the earlier prophets. Therefore great anger came from the LORD of Hosts (Zechariah 7:12).
The prophets spoke under divine direction and inspiration of the Spirit in the Name of Yahweh— “Thus saith the LORD” (413 times in KJV).
Concerning this salvation, the prophets who prophesied about the grace that would come to you searched and carefully investigated. They inquired into what time or what circumstances the Spirit of Christ within them was indicating when He testified in advance to the messianic sufferings and the glories that would follow (1 Peter 1:11).
First of all, you should know this: no prophecy of Scripture comes from one’s own interpretation, because no prophecy ever came by the will of man; instead, moved by the Holy Spirit, men spoke from God (2 Peter 1:20-21).
All Scripture is inspired by God and is profitable for teaching, for rebuking, for correcting, for training in righteousness, so that the man of God may be complete, equipped for every good work (2 Timothy 3:16-17).
“Inspired” is the compound word yeopneustov (theopneustos), which denotes God-breathed. The Holy Spirit superintended the lives of the biblical writers much as He guided Mary at Jesus’ conception. Mary was able to pass on her human nature to Jesus, but she was not able to pass on her sinfulness. Similarly, the biblical writers could pass on their human style of writing to the written text, but they were prevented from passing on errors at the critical moment their pens hit the paper and words appeared (1 Corinthians 2:9-13) (Robert Gromacki in Understanding Christian Theology, 413).
Thus, the Bible is inerrant, without error in all matters, including theology, history, geography, and science.