[Raskolnikov] had to tell her [Sonia] who had killed Lizaveta. He knew the terrible suffering it would be to him and, as it were, brushed away the thought of it. (5.4.1)
Raskolnikov knows that confessing, the act of speaking his crimes, causes him to suffer – yet, he can't stop doing it. He needs to tell. The suffering of telling is less than the suffering of not telling.