HTC Desire 820 dual sim root failed I tried to root my mobile phone HTC desire 820 Dual sim.

I unlocked boot loader, flashed TWRP2.8 but none of Super SU could root my phone (Android version 6.0.1).

Recently been to HTC service center to replace battery. They mentioned that if we change battery for unlocked phone, phone may not work.

How to remove TWRP and get my phone back to early setting and lock it?
I guess you couldn't root phone probably because phone use lz4 format (I just guess) or you was doing something wrong. However, that what they said is bullshit, what battety has to do with that if bootloader is unlocked? Maybe they said they WON'T fix it if bootloader is unlocked because unlocking bootloader is way to lose warranity? To get your stock recovery back you'll have to flash stock firmware, you have a guide for that on their site, if not then there is guide on xda. And to lock bootloader that is not possible not fully because you can relock bootloader (command is I think "fastboot oem relock" or something like that), in that case bootloader state would return 'relocked' so even than they will know that you played around.