Panic attacks that happen at night can be caused by stress during the day which then leads you to stress at night which can cause nightly panic attacks.
Anxiety and or post traumatic stress disorder are also common causes of nightly panic attacks and if you continue to experience nightly panic attacks I would speak with a therapist about it to help you cope with the stress or anxiety.
You could simply just be so worried about things in your life that could also be keeping you awake and then lead to the panic attacks.
A therapist can help you with the panic attacks and could get you some anxiety medicine that can help stop the panic attacks at night and during the day.