In the beginning was the Word, and the Word was with God, and the Word
was God. (John 1:1, NIV)
All Scripture is God-breathed and is useful for teaching, rebuking,
correcting and training in righteousness. (2 Timothy 3:16, NIV)
The Greek word for 'Word' in
John 1:1 is Logos(λόγος) and 'Scripture' in
2 Timothy 3:16 is Graphey(γραφή). Though 'Word' and 'Scripture' are very much related, they are necessarily not the same.
The 'Word' in the context of John-1 is a divine entity, which is Jesus Christ, who existed in the beginning with God. 'Scripture' in the context of the Bible mostly refers to the written words of God. Scripture is a subset of the Word. The Scripture may represent the Word and illustrates the picture of the Word but it cannot fully explain it, because scriptures are written in human language which has limitations to describe Heavenly things.
We cannot say that the words we have in the Bible are the only words that God has spoken. Therefore, the Scripture that we have is not equivalent to the Word, it is only part of the Word. Hence,
John 1:1 was written as such by the writer, using Word(λόγος), instead of Scripture(γραφή), where the Word refers to Jesus Christ, who is the source of Scripture.