I am confused about whether or not it was St. John the Baptist who wrote the Book of John in the New Testament. I thought this was a different John who was one of the apostles.
You are correct in that the author of the Gospel of John was definitely not St. John the Baptist, but called himself the "Beloved Disciple", who testified to the truthfulness of the eyewitness account about Jesus and his ministry on earth (John 21:24).
The identity of the Beloved Disciple has been associated with St. John, son of Zebedee, one of the 12 apostles called by Jesus Himself (Mark 3:13-19). For more on the identity of the "Beloved Disciple", you can read Who Wrote the Gospel of John? written by Dr. Gary M. Burge for the blog of the publisher Zondervan, which is academically responsible, or the wikipedia article.
My New International Version of the Bible makes this comment regarding the author of the Gospel of John:
The author is the apostle John, "the disciple whom Jesus loved" (13:23; 19:26; 20:2; 21:7, 20, 24). He was prominent in the early church but is not mentioned by name in this Gospel - which would be natural if he wrote it, but hard to explain otherwise.
Early writers such as Irenaeus and Tertullian say that John wrote this Gospel, and all other evidence agrees.
My New Living Translation Bible has this to say about the author:
Leaders in the early church, beginning in A.D. 125, wrot that it was the apostle John, the son of Zebedee (se Eusebius, Church History 3.23)... Most scholars believe that John completed writing his gospel by A.D. 90.
My English Study Version Bible agrees with the above and, as will become clear, eliminates John the Baptist as the author:
The internal evidence indicatesthat the author was (1) an apostle (John the Baptist was not); (2) one of the twelve disciples (John the Baptist was not); and still, more specifically (3) John the son of Zebedee (John the Baptist was the son of Zecharia the priest - See the first chapter of Luke's gospel).
The external evidence from the church fathers supports this identification (e.g., Irenaeus, Against Heresies 3.1.2)
Because John the Baptist was beheaded at the start of Jesus' ministry, it would not have been possible for him to have written the gospel of John.