So the battery won't charge, when the laptop is plugged in? That sounds like a faulty battery.
Can you start it without the battery?
the computer is on the mains then it seems the battery loses its power and gos off.
if the battery is faulty,should no the computer stay on if plugged into the mains?
i don't want to buy a new battery if it some thing else.
Yes, you are right, it should work. I mean, if the battery is simply old, and its capacity is down, the computer, when plugged in, should work without any problems. But batteries also have a special control unit, which decides, when to charge, what is the current level, things like that. And that can also go wrong, and it may prevent the computer from getting electricity.
Can you get out the battery, and try to start the computer?
If it works, then something is wrong with the battery. If it doesn't work, then something is wrong with the computer.