I would like to know whether a laptop should run on electricity to save battery power?
You can do it, charge the battery, then take it out.
A battery should be charged and discharged regularly; staying full is not optimal. The lifespan of a battery is the longest when it is continuously charged between 20-80%.
What you ultimately want to achieve are as few battery charging cycles as possible and as little charging as possible between 90% and 100%. If the battery is removable, always do it when you don't need it. Otherwise, see if you can set charging thresholds, e.g. Does not recharge at> 90%.
Today, of course, they can withstand more than the old batteries. It is still advisable to take the battery out when you don't need it.
My laptop is around 10 years old and I sometimes notice when I forget to turn on the power that it doesn't last long. Otherwise I never bothered about it and it wasn't a reason for it. I don't think removing the battery would add any more benefit. On the contrary. If you write extensive work and accidentally switch off the power, the last change is not saved. That doesn't happen with a battery.