@disha43291 that is what can happen when your battery no longer takes a charge. Your tablet shows the charging symbol because it is trying to charge the battery, but once you disconnect, it'll turn off since the battery is unable to hold a charge. I would suggest you start of by replacing the battery, then re-evaluate.
You did not tell us what exact model your Tab A is so we can't help you with the battery replacement.