That's a good question. Interesting to think about.
Since I believe the Bible is perfect, I would hold that whatever means the human writers used to produce the Scriptures (writing, collecting other texts, composing, editing, proofreading, etc - the processes might have been different for different books), the entire process was directed by God's Holy Spirit to produce a final text that said precisely what God intended, word for word.