Whenever I'm connecting the charger it suddenly starts connecting and disconnecting and because of this charger tip getting too hot that you can't even touch
but when I charge the battery while the laptop is off it is working perfectly fine without any issue.
If it works fine without the laptop powered on, and only does this when it is turned on, then you likely need to replace the charger.
Were it the laptop itself, then you would get the problem no matter if it was turned on or not. The same goes for if it was the outlet it is connected to. It would react the same way no matter if on or off.