The infallibility and divine authority of the Scriptures are due to the fact that they are the word of God, and they are the word of God because the inspiration of the Holy Spirit gave them.
The Holy Scriptures belongs to the conception of Scripture that, though originating "by the prophets in many portions and in many ways" (Heb. 1:1), it should yet, in its completeness, constitute a unity, evincing, in the spirit and purpose that bind its parts together, the Divine source from which its revelation comes.
In full consciousness and fulfillment of Jesus’ oft-repeated promise to guide them unto “all the truth,” the apostles claimed divine authority for what they taught orally and in their writings.
All Protestants agree in teaching that “the word of God, as contained in the Scriptures of the Old and New Testaments, is the only infallible rule of faith and practice.”
"As the Bible is firmly rooted in the God whose Word it is, each member of the Trinity is involved in its inerrancy. Thus, three arguments can be stated, one in terms of each member of the Godhead. That the Bible is without error is clear from these three arguments." - Norman L. Geisler
Holiness is used of God’s Word similarly to the way it is used of God, namely, to be set apart from other things, to be sacred, to be exalted. Paul told Timothy, “From infancy you have known the holy Scriptures, which are able to make you wise for salvation through faith in Christ Jesus” (2 Tim. 3:15).
The mode of operation by which the Holy Spirit worked with the authors in order to assure an infallible and inerrant product is a matter of much speculation among theologians. The mystery remains inscrutable, but the process is intelligible and the parameters are definable.