This is the reference for the story of the man who killed 99 people and then wanted to repent. It’s in Saheeh Al-Bukhari as well, but the Saheeh Muslim version has some additional details.
Abu Said al-Khudri reported Allah’s Messenger (may peace be upon him) as saying: There was a person before you who had killed ninety-nine persons and then made an inquiry about the learned persons of the world (who could show him the way to salvation). He was directed to a monk. He came to him and told him that he had killed ninety-nine persons and asked him whether there was any scope for his repentance to be accepted. He said: No. He killed him also and thus completed one hundred. He then asked about the learned persons of the earth and he was directed to a scholar, and he told him that he had killed one hundred persons and asked him whether there was any scope for his repentance to be accepted. He said: Yes; what stands between you and the repentance? You better go to such and such land; there are people devoted to prayer and worship and you also worship along with them and do not come to the land of yours since it was an evil land (for you). So he went away and he had hardly covered half the distance when death came to him and there was a dispute between the angels of mercy and the angels of punishment. The angels of mercy said: This man has come as a penitant and remorseful to Allah and the angels of punishment said: He has done no good at all. Then there came another angel in the form of a human being in order to decide between them. He said: You measure the land to which he has drawn near. They measured it and found him nearer to the land where he intended to go (the land of piety), and so the angels of mercy took possession of it. Qatada said that Hasan told him that it was said to them that as death approached him, he crawled upon his chest (and managed) to slip in the land of mercy. [Saheeh Muslim, Hadeeth No. 6662]