First, you should write your custom ROM with admin rights. Then access /system/app via some file manager and copy desired apk into above mentioned folder.
In short and aside of any jokes… If you are considering publishing application to playStore, this is not possible “programmatically”.
If you are writing app for you, your only option is to root the device and copy apk as mentioned above.