I think that the typing the same sentence over and over just started as plain old writer's block, plus it was a way to get Wendy to leave him alone for a few hours a day. He'd come there to write his magnum opus, and if it wasn't coming out at first due to writer's block, well, he was going to damn well sit there at his typewriter and type nonsense while trying to think about what to write, in the hopes that eventually something would click and the novel would start to appear on the paper. And while he did that, at least Wendy was off his back.
The whole typing thing wasn't the act of a madman, not at first, it was the act of a man who was unhappy and angry, and who could easily be pushed over the edge if anyone wanted to give him a shove. Here was a man who hated his wife and who was angry at himself and the whole world, and whose self-image was maintained by pretentions he couldn't live up to. Which is a common enough mindset, but most people who are that unhappy and vulnerable to cracking have more sense than to shut themselves in a snowbound hotel for months.
That's some clever 'scriptwriting' on your part. I like it.