For the first time in his life, Jean is able to truly love someone because he has Cosette.
Jean isn't prepared to be a father. When he goes to fulfill his promise to Fantine, he can't know that his entire life will be changed.
In chapter 3 of book 4, Jean sits by Cosette's bed waiting for her to wake up. He can feel a change in his heart. He thinks back on the past 25 years; he was alone and was never a father, husband, brother, or friend. He doesn't remember his sister or their children; he only has a vague memory of them.
He thinks of himself as a poor old man with a perfectly new heart. He looks at her and feels the feelings that a mother might feel. As soon as he took her away and decided to care for her, he was changed inside. He thinks that "Cosette caused the dawn of love to rise."
Cosette gives Jean someone to love and someone to live his life for. Once he was no longer able to live the new life he'd built because his old identity came back to haunt him, he didn't have an immediate plan. It wouldn't have been unusual for him to feel despair. But finding and choosing to care for Cosette gives him someone to love and a reason to go on.