"Just in order to" is really awkward. I would never write that. In fact, it's difficult to find examples of when "in order to" is better than "to."
The phrase clearly applies to why he wrote the novel. I don't see how it could modify "novel" instead if the writing of the novel.