My heart goes out to you is actually fine.
I know how it feels to lose a loved one. I know how it feels when we lose someone we love. Either of those would be fine. If her loss was also a parent, you could even say "I know how it feels to lose a parent."
(I also think that your friend will appreciate your thoughts, even if there are tiny grammatical mistakes, because what is in your heart is more important that the way the words are arranged on the page.)
Just a little word of caution though -- people don't necessarily feel things the same way. For example, if the death in her family was after a long, painful illness, she may feel differently than someone who lost a parent very suddenly in a car accident. So it may be best to say something like "I know how I felt when I lost my parents, and I can only imagine how you must feel now. You are in my thoughts."