Copy, chmod and chown in three commands leave a short moment when a secret file has the wrong permissions.
sudo install -m 640 -o root -g www-data app.env /etc/app/app.env
sudo install -d -m 750 -o app -g app /var/lib/app
install copies the file and sets the mode, owner and group you ask for in one command. -d makes a directory, parents included. It overwrites an existing file at the destination, so check the path first. I find it a good fit for deploy scripts and Dockerfiles.
Further reading: install manual page