Your muscle cramps can be due to many factors like weakness of muscles, nerves, body's response to fear, physical strain etc. Its not necessarily linked to your dying.
Next Steps
See another doctor/change the medicine if you have any concerns about the shivers and pain. See a counselling psychologist to learn to think rationally and manage the fear of death.
Health Tips
Do deep breathing exercise like anulom vilom and aerobic exercise which is good for people with anxiety.