There can be many causes.
It is most likely a problem with your battery, either it is not connecting properly or the battery itself is dead. Generally lithium ion batteries (most likely the type in your laptop) last for roughly 20,000 charge cycles before losing a considerable amount of their capacity. Depending on how often you use your laptop, the life span of the battery could range from 1-5 years.
If you end up replacing your battery, try not to keep it charging constantly. It is always good to let lithium ion batteries discharge at least half way once every so often, sometimes this can improve their lifespan.
I would also recommend the course of action that Laptop_Nerd has suggested as well. Only buy a new battery if you are sure that it is dead.
From your description it sounds like there is nothing wrong with the laptop itself (except the battery), so if you don't need to take it on the go, you could just use it while plugged in. Doing this will not harm it, the only thing it could potentially harm is the battery but that seems to be dead so it is no problem!
Hope this helps