I want to make a lock screen application. When the phone is in the lock mode, it will turn off the phone while the USB is plugged for prevent other users from accessing the
Yes it is possible,
Using making system application(Using firmware) not download application. You can get the code for power off android device from AOSP.