If MagSafe charging is not working, then try using a USB-C charging cable instead to try & charge the battery.
Also, review the following Apple article:
If your MagSafe cable or power adapter isn't working - Apple Support
More than likely the Battery in your laptop is bad and needs to be replaced. The symptom is exactly what happens when a Lithium Battery is allowed to be completely discharged for an extended length of time. Have Apple or an Apple Authorized Service Provider examine the laptop to confirm & provide you with a repair estimate.