Here are a few tips to help you find the right words. First, trust your instincts about what to say. A short note about a happy memory--condensed to two or three sentences may be appropriate."I remember the wonderful homemade banana bread your Mom gave me after my surgery. Her kindness helped in my recovery." Something as short as "our love and prayers are with you in this difficult time," is also fitting. If you're really stuck, check out the link to Hallmark's page for additional help.
There are also some words to avoid in the note and perhaps they're more important to highlight. It's tacky to say, "At least he's not suffering now," or "She lived a long life," or "We've all gotta go sometime." Avoid these words at all cost.
Kindness, courtesy, and sympathy are all part of this important note to the bereaved. A sympathy email is also tacky. A nice card with a personal message, mailed in a timely manner is the requirement for this occasion. Those cards are usually cherished and saved. An email is not.
The sympathy note is not something we like to contemplate, but at some point, we must write. May your words be sweet and full of comfort to the one who has suffered loss.