Some things to say to a dying person are "I love you" and that it's OK to pass on. A dying person also usually finds comfort in hearing happy stories from his life and enjoys hearing about his positive contributions to the world.
Affirming love for a dying person establishes a connection and respect with the person. If animosity exists between the people involved, offering or accepting forgiveness is also something to say to the dying person. If the person dying helped the other person in life, a word of appreciation is appropriate. In addition, the dying person likely wants to hear specifics as to how he helped others or what he means to others. Acknowledging the person's suffering and giving him permission to pass on offers the dying person comfort and encouragement to find a peaceful transition.