I think the whole movie was one instance of a loop. Donnie was the "if" keeping the loop going. The fact that he didnt die gave him the chance to find out how to travel thru time. He went back to before the jet engine took out his room and let it kill him. Thats the only way to break the loop.
on top of the that, he was still crazy. Frank was probably Donnie\'s way of dealing with everything he knew about the future