The app you ask for cannot exists because it needs these permissions to shut down other apps. There is also no feature in android to simply prevent an app from running in the background. Here are the three options you have :
- Kill the task and force stop the app every time you quit it : this doesn't really achieve what you want because the app could be restarted by any other process on your phone at any time
- Disable the app : GOS offers the possibility to disable user installed apps and it does precisely what you want. The downside is that the app will disappear from the home screen and app drawer. The only way to access it is now to go to Settings > Apps > See all apps > Your app and enable it then open it. This can be simplified by adding a settings widget to your home screen and select the "Apps" option which will create a shortcut to Settings > Apps > See all apps.
- Install the app in a secondary user. That way when you stop using the app, you can long press the power button and select "End session" which will shutdown the user and all apps in it. That's how I would do it. You can even transfer the app from the Owner user to the new user so you don't have to setup any app store in the new profile then uninstall it from the Owner
Now you didn't say why you want to kill the app(s) when not using it/them. However, I see two possible reasons and none requires what you are asking for. If it is out of concern for the battery usage, you can :
- Go to Settings > Apps > See all apps > Your app > Battery and select "Restricted". This prevents the app from running in the background most of the time
- Go to Settings > Battery > Battery Saver and keep it activated all the time. At the bottom of this page it is even written "Battery Saver [...] limits or turns off background activity..."
If it is out of concern for data collection, there are two things you may care about :
- Record your usage : as long as you use an app, nothing can prevent it to send back detailed information on what you do and when, unless you turn off the Network permission. I'm assuming you can't though because you probably wouldn't ask this question otherwise
- Access information in the background like location, camera, microphone, etc : all temporary personal informations (understand "things constantly changing" unlike contacts for example) are accessed through permissions which have the "Only when using app" option. If you grant this type of access, it doesn't matter that the app is constantly running in the background