FTP file with a different port

I am using below code to ftp file and it errors out saying Servname not supported for ai_socktype ... if I do not use port number 2020 then it is not connected

#!/bin/sh
USER=$1
PASSWD=$2
server=$3
remoteFile=$4
localDir=$5
ftp -n -v << EOF
open $server 2020
user $USER $PASSWD
ascii
cd $localDir
mput "$remoteFile"
quit
EOF
exit 0

It is connecting through command line when I use FTP and then open ServerName 2020

More details, please. Debug logs, error messages?

That error sometimes means an odd misconfiguration issue, post the output of ls -l /etc/services

Executed: ls -l /etc/services
Reply=0
Output from command ====>
-rw-r--r-- 1 root root 646199 Feb 6 13:33 /etc/services

It worked with a Python script I found online. Thank you all