Hi T.~
God bless you for loving this little girl!!
You got a ton of good advice here, but I just wanted to respectfully disagree with the responders who said to chop her hair off. I would only consider this AS A LAST RESORT, AND if the little girl dislikes her long hair. And I think there are many feasible options before cosidering cutting it. I know as a child growing up, I loved my long hair, and it would have broken my heart, not to mention what it would have done to my self-esteem to have someone chop my hair off without my expressed desire. I would do everything possible to help her get her hair in order, and teach her how to manage it herself, long before I'd consider cutting it off... that is unless she WANTS it shorter... That said, she could keep her long hair and get some layers put in it, which could make it easier to comb out, but still keep most of the length. Plus layers in wavy hair will accentuate her waves, so she might really like that...
I have always had longer hair, and I would say that once you get the mats out, it is important to have a routine to keep them out. Here are my suggestions for that:
1) Get her a moisturizing conditioner and teach her to use it heavily with each wash... and comb out all tangles with wet hair while the conditioner is on, with a wide tooth comb. That is the easiest time to comb out tangles.
2) After shampooing, rinsing, conditioning, rinsing, and towel drying (always pat and squeeze, never rub), apply a leave-in conditioner or detangling spray and comb out all tangles again.
3) Get her a wide tooth comb for combing through her wet hair, and find her an effective brush, either a flat paddle style, or a brush with long teeth to get through all layers of the hair, to the underneath, when it's dry.
4) Teach her to shampoo, condition, and brush her hair ALL THE WAY THROUGH TO THE UNDERNEATH. I say that because I have a young friend of the family who has extremely thick hair (she's now 13) but when she first started to care for her own hair, I watched her wash it, and she didn't even get the underneath wet, let alone shampooed, conditioned, and combed! And she even didn't realize this until I told her and showed her how to do it properly.
5) Teach her to put her hair in one braid in the back before she goes to bed. My young friend also learned to do this. It works wonders at keeping the hair from tangling while she sleeps.
Best of luck to you and your young friend. So sorry for her family's loss. She is lucky to have you and you are doing a wonderful thing for her.
Please don't suggest cutting her hair unless SHE WANTS IT CUT!!!