I have the following logic in a bash script that works:
#copy records to delete file to respective servers. faster than running locally scp -o StrictHostK
You don't need to copy the file to the server. What you're looking for is the STDIN for COPY:
STDIN
COPY
cat records_to_delete.txt | psql $server -c "COPY tmp_widgets FROM STDIN;"