Do you know when this snake was born? I'm assuming she was quite small/young, & if so, keep in mind that one reason snakes are cheaper to buy when very
young is that if there are any birth defects that affect their longevity (things like internal malformations that occur more frequently when snakes are inbred but
which can occur anyway) it's more likely that they will occur early on like this, and it's one reason that when you buy a neonate/hatchling snake, that you make
sure they have a feeding record...the longer the better, as that gives you some assurance that everything is working OK internally. This is but one possibility.
Another possibility from the strange motions you describe is that she was exposed (prior to coming home with you) to some sort of toxic chemical...even mite
treatments (if not dosed very carefully for the size of the snake) can have deadly consequences. The odd motions suggest a neurological issue, which could
also have been something contagious...no way we can say for sure "from here". The fact that she was willing to eat, though, suggests that she felt good enough
to have an appetite.
Again, sorry for this sad & sudden loss.