You can probably replace your laptop’s battery yourself if you are sure that that is the issue.  However, the problems you are experiencing could also be related to the charging port.  If you are unsure, take it to a repair shop near you!