There are a few things you can try if your MacBook is not charging its battery:
Check the power adapter (Magsafe Charger): Ensure that the power adapter is plugged in and working correctly. If the power adapter is damaged, replace it.
Check the charging cable: Inspect the charging cable for any damage. If there is visible damage, replace the cable.
Reset the SMC: Try resetting the System Management Controller (SMC) on your MacBook. The steps for resetting the SMC vary depending on your MacBook model. You can find instructions for your specific model on the Apple Support website.
Check the battery: If the battery is not charging, it may be faulty and need to be replaced. You can check the battery health by going to the Apple Menu > About This Mac > System Report > Power. Look for the “Health Information” section and check the “Condition” of the battery.
Check for software issues: Sometimes, software issues can prevent the battery from charging. Ensure that your MacBook is running the latest version of macOS and that there are no pending software updates.
If none of the above steps work, it may be best to take your MacBook to an authorized Apple repair center or Esmond Service Centre if your macbook is out of warranty.