Hello! You asked what Rahim Khan did wrong in Khaled Hosseini's The Kite Runner. In the novel, Rahim Khan is Baba's business associate; he is almost like a second father to Amir. After Baba and Amir flee Kabul, Rahim Khan stays in Baba's house, hoping to return the house to Baba after the turmoil in the country dies down. However, Baba dies in America; Rahim Khan, himself dying from a fatal illness, calls up Amir and tells him that there is a way to atone for his (Amir's) sins, a "way to be good again."
When Amir and Rahim Khan meet up, one of the things Rahim tells Amir is that he did not live alone in Baba's house, and that Hassan lived with him. He goes on to tell Amir that he had thought about writing and telling Amir about it, but was unsure that Amir would want to know such a thing. He asks Amir if he was wrong in assuming so. Amir does not want to discuss Hassan at all; he still remembers his shameful treatment of Hassan. His guilt has never left him; it has only festered deep in his subconscious, hidden from others. However, Rahim Khan reveals to Amir that he has always known of Amir's guilt. When he reveals the deep family secret that has been kept from Amir all these years, Amir is at once incredulous, angry, and heart-sick. Amir accuses Rahim Khan of being an unprincipled liar for hiding the fact that Hassan is actually Amir's brother.
Amir responds like a wounded animal. One suspects that Amir's guilt is compounded by the knowledge that he mistreated his own brother for many years. Amir also feels betrayed by both his father and Rahim Khan. However, Rahim Khan tells him that there was no way they could have told him back then. The shame and social stigma would have been too great for a young Amir to handle. A man's honor is highly regarded in Afghanistan and Baba was a highly regarded member of society. Amir soon comes to realize why Rahim Khan chooses to reveal the secret now. It is not solely to make amends for his part in deceiving Amir; it is for another more important reason:
As it turned out, Baba and I were more alike than I'd ever known. We had both betrayed the people who would have given their lives for us...Rahim Khan had summoned me here to atone not just for my sins but for Baba's too.
Hope this answers your question!