What is the best/preferable way to save plist in /Library/LaunchAgents directory?

I have a prelogin agent that works as expected but now I'm unsure of how do I go about saving/removing its plist as needed? I tried using FIleManager but for obvious reasons I get "You don’t have permission to save the file" and I'm not able to find a way to prompt for user permission from within my swift app.

**NOTE: I feel like I need to add more context so the question is easier to answer. My end goal is that once the user "turns on" the app it will be opened during and after login, that's where I need my prelogin agent. But also when the user "turns off" the app I need it to stop getting launched which is when I need to remove my prelogin agent in order to prevent this.

What is the best/preferable way to save plist in /Library/LaunchAgents directory?
 
 
Q