How can I edit apk installed in devices

Hi guys I wanted to know how I can modify the code of the apk that have been installed on the devices remotely, I should add a piece of code this helps me a lot if someone knows how to solve it gives me a big hand

I haven’t found anything about it