I would suggest something like this:
Dear *friend's name*,
I am really sorry about your lost. (S)He was a good woman/man. If there is anything I can do or if you just want to talk, I'm here for you. :)
It may be awkward or hard to talk about such things, but nonetheless, you need to tell her/him that you are there for them.