A lot of the times when you don’t know what to say, it’s not because you can’t find the right words, but the right words simply don’t exist. There’s nothing that captures your sorrow for the person.
Funny enough, the right thing to say is that you don’t know what to say. And just offer yourself to be there for them.