The inspiration/revelation by the Holy Spirit to the human writers of the Scriptures is a pivotal doctrine of Christianity. So how did that come to be?
The idea of divine inspiration did not start with Christianity but was already established in Judaism.
The Hebrew OT was already considered sacred.
Jewish tradition held that prophets spoke under divine guidance i.e. Moses and Isaiah.
Texts were believed to carry God's authority, not just human ideas.
Jesus and his followers reinforced this view. Jesus frequently quoted Hebrews Scriptures as authoritative. His followers (the apostles) believed they were guided by the Holy Spriit in teaching and writing. We see this in 2 Tim3:16
"All Scripture is God-breathed".
After Jesus' death, writing began to circulate. The Gospels (accounts of Jesus' life. Letters from leaders like Paul the Apostle and other texts such as Acts and Revelation. In the beginning there was no fixed NT.. Different churches used different texts.
Church leaders gradually identified certain writings as authoritative based on
Their link to apostles (apostolic origin
Consistency in teaching
Widespread use in worship
By the fourth century a core set of books was widely accepted. Formal recognition came through church decisions: councils such as Council of Hippo and Council of Carthage. They listed the books of the NT. They were not creating Scripture. but recognized what was already widely accepted. This became the canon.
The Theology of Inspiration
The belief that Scripture is inspired developed into doctrine. Christians came to believe God worked through human authors and is called divine inspiration. God is the ultimate source. Humans are the writers, using their own styles and contexts. Christianity inherited a belief in sacred writings from Judaism, but Jesus and the apostle affirmed that belief and extended it. God speaks to mankind through his word.
2 Peter 1:21
"Men spoke from God as they were carried along by the Holy Spirit."
I suppose one could be saved without knowing or before learning the Christian doctrine of the Scripture being the inspired word of God. After all, one is not saved by doctrines but one is saved by believing and trusting in the person and work of Jesus. But let me ask you this: If it is not the word of God and therefore may contain both things that are true and those that are not, how do you trust and believe any of it?