The sage who cut off his own hands was Likhita and his elder brother is Shankha. The story of these two sages is said to Yudhishtira by Sage Vyasa to remind his duty of chastising. This story occurs in 23rd chapter of Rajadharmanusasana Parva of Shanti Parva of Mahabharata.
These were two sages named Shankha and Likhita lived in different hermitages. Both of them were at the banks of the river Bahuda. Both the hermitages had beautiful trees with fruits and flowers. Once on a time Likhita came to his elder brother's hermitage and Shankha was not at that place on no fixed purpose. He was hungry at that time and plucked many ripe fruits. While he was eating them, Shankha arrived at the hermitage. Beholding his brother he said
'Whence have these fruits been obtained and for what reason art thou eating them?' Approaching his elder brother and saluting him, Likhita smilingly replied, saying, 'I have taken them even from this retreat.' Filled with great rage, Sankha said unto him, 'Thou hast committed theft by thyself taking these fruits. Go and approaching the king confess to him what thou hast done. Tell him, O best of kings, I have committed the offence of approaching what was not given to me. Knowing me for a thief and observing the duty of thy order, do thou soon inflict upon me, O ruler of men, the punishment of a thief.'
Thus addressed, Sage Likhita saluted his brother and gone to the Royal sage(Rajarshi like the king Janaka) Sudyumna to get the punishment. Having heard that the sage Likhita had arrived to the king's palace, the King Sudyumna himself advanced along with his ministers. He greeted the king and ask why he has arrived to the king's palace. The sage then replied to the king:
'Do thou promise first that thou wilt achieve it. It will then behove thee, after hearing me, to accomplish that promise. O bull among men, I ate some fruits that had not been given me by my elder brother. Do thou, O monarch, punish me for it without delay.'
King Sudyumna answered
'If the king be regarded as competent to wield the rod of chastisement, he should be regarded, O bull among Brahmanas, as equally competent to pardon. Purified in respect of thy act, O thou of high vows, consider thyself as pardoned. Tell me now what other wishes thou hast. I shall certainly accomplish those commands of thine!'
But the sage didn't ask for any other favour. Then the King Sudyumna caused the sage's hands to be cut off. The sage has returned to his brother's hermitage after being punished. He then in great effection spoke to his elder brother:
'It behoveth thee now to pardon this wretch that hath been duly punished (for what he did).
Then his brother Shankha answered the sage:
I am not angry with thee, nor hast thou injured me, O foremost of all persons conversant with duties. Thy virtue, however, had suffered a shock. I have rescued thee from that plight. Proceed without delay to the river Bahuda and gratify duly, with oblations of water, the gods, Rishis and the Pitris, and never again set thy heart on sin.
Hearing this from his brother, Likhita did the same. Now the miracle happened...
Hearing these words of Sankha, Likhita performed his ablutions in the sacred stream and set about for commencing the water-rite. Upon this, two hands, resembling two lotuses, appeared at the extremities of his stumps. Filled with wonder he came back to his brother and showed him the two hands.
Shankha was not surprised at all and said to his brother.
All this has been accomplished by me through my penances. Do not be surprised at it. Providence hath been the instrument here.
Likhita asked his brother why didn't he purify him using his penances before he was punished. Then he answered.
I should not have acted otherwise. I am not thy chastiser. The ruler (who has punished thee) has been himself purified, as also thyself, along with the Pitris!.
In this way, the hands of the sage Likhita were cut off and restored by his brother Shankha.
On a side note, the stream where Sage Likhita took bath and gave oblations got its name because it gave the sage his arms back (Bahuda - Which gave arms). This river is now popular as Cheyyeru river in Telugu and is located in the state of Andhra Pradesh. The Telugu name also derives its name from the same incident. Cheyyi means a hand and eru(long e) means a stream.