How do I replace files?

I’m trying to update a file using flyctl ssh sftp shell but getting an error that the file already exists on VM. How can I override it with my local file?

AFAIK, it’s not allowed now.

If you connect to Wireguard VPN and issue
a new SSH credential using
fly ssh issue --agent

You can use scp and it will allow overwriting files then:
scp <local-file> root@<application-name>.internal:<server_path>