While there can be several reasons for error, most likely is:
GCP VM you created does not has permission to write to storage bucket. The VM creation command that I have written (as below) has scope: “https://www.googleapis.com/auth/cloud-platform” which gives VM permission to all the GCP APIs including GCS Writes.
gcloud compute instances create sftp-test --zone=us-central1-c --machine-type=n1-standard-1 --subnet=default --scopes=https://www.googleapis.com/auth/cloud-platform --image-family=ubuntu-1604-lts --image-project=ubuntu-os-cloud --boot-disk-size=10GB --boot-disk-type=pd-standard --boot-disk-device-name=sftp-test
If you created your VM from UI, it only gives GCS reads permission to VM.