To Wendy and the audience’s confusion and horror, Jack was not writing a book with the the help of the peaceful quiet and tranquility of the hotel. It was a madness mantra spurred by supernatural and natural forces that quickly told the audience that Jack Torrance has completely snapped. But before the madness, what was he actually writing?
It is very common of Stephen King to connect his stories, with different characters popping up in different stories, and events of other books being talked about in the third person. In Misery, Annie Wilkes tells Paul Sheldon that the Overlook Hotel blew up, so The Shining can be connected to other Stephen King works.
The book and the movie are quite different, with Stephen King famously not really liking Kubrick’s version. While Kubrick’s interpretation is iconic, there are some details left out that would have filled in the gaps, unlike in the book.
But what is the connection to the other work? The strongest contender is Apt Pupil, a novella in a collection called Different Seasons. It’s about a teenager named Todd Bowden who finds an elderly German immigrant named Arthur Denker, and accuses him of being a Nazi war criminal named Kurt Dussander. The accusation turns out to be correct, but instead of informing the police, Bowden asks him about the Holocaust and his crimes, becoming more interested and crazed as the story goes on. His grades slip, and he forges his report cards, which teachers see a lot of.
Some of the themes fit in with Jack’s backstory, namely his alcoholism getting him fired as a teacher for beating up a student. Now that may sound like a weak connection, but one of the characters in Jack’s play is named Denker. Also he wrote Different Seasons right after The Shining.
Stephen King makes it a habit of putting himself in his books as an avatar, so having Jack write Apt Pupil and then write it himself just after The Shining makes it very interesting indeed.