Ignore the time-travel distraction. it is merely a method to convey the author's message. That message is this: Think about the end effects of every action you are considering. Avoid what most people do which is merely focusing on the most immediate satisfaction available to them.
Where do we see this message the most explicitly? At the beginning of the film, he asks his grandmother where to start reading the book, and she answers 'From the beginning" At the end of the film he asks the same question, and she answers "From the end'. in other words: Look at the results you want first, then choose your path.
By following this advice, he gradually leaned to approach the crisis with his girlfriend from the end, and succeeded. He also learned how to make his grandmother able to enjoy a full life with his grandfather, and succeeded.
instead of focusing on his immediate happiness, he realized that by sacrificing his happiness, he could (By going back) insure the happiness of his other self, his girlfriend, and his grandmother.