Android shuts down when unplugged
It seems like your battery is broken or something. I suggest bringing it back to HTC and have them fix it for you. Please don't do it(replacing battery/open then phone case) by yourself as it will void your phone warranty.

PS: HTC will have their way to replace the battery for you, but I am not sure whether it will cost you some money or not.

Hope it helps =)