This is a great question. To answer it, we should look at the things Dr. Rank does in A Doll's House and ask how his actions relate to those of Nora.
First, Dr. Rank has inherited a disease from his father. The idea of inheritance is also brought up in regards to Nora and her rash behavior in taking loan from Krogstad, as he behavior is said to be reminiscent of her father's manner. The idea that inherited traits can inform a person's behavior and demeanor is an important undercurrent in the play.
Dr. Rank also manages to tell Nora a difficult truth, directly, and is prepared to live with the results. He tells Nora that he loves her. Later Nora finds the strength to tell Torvald a difficult truth. Dr. Rank's confession is a thematic preparation for Nora's later confession but also a lesson to Nora about honesty.
Finally, Dr. Rank chooses to leave Torvald's friendship because Torvald would not deal well with his sickness. This choice emphasizes both Rank's restraint (and strength) and Torvald Helmer's weakness. When Nora informs Torvald that she will be leaving it is, in part, predicted by Rank's choice to leave his friendships behind in order to deal with his illness.
The choice to isolate himself so that he can best deal with his personal problems is an important example for Nora as she decides to do the same thing. If Dr. Rank were to be eliminated from the play, the resonances that exist between his actions and Nora's actions would disappear, thinning the play thematically and changing the play's orientation toward a more pure consideration of secrecy and crime and away from the moral considerations of how to deal with deep personal conflict.
thank you alot =)