Copying files to remote server

I am trying to copy code to remote server, doing something like this

However it is copying one file and than the script exits

i=0; j=0
while read fn; do    

  dir=${fn%/*}  # Gets directory path
  fnm=${fn##*/} # Gets filename excl. path

  rgx_nwk="s/${nwk}/${nwk}.sac/g"
  odir_nwk=`echo "$dir" | sed -e $rgx_nwk`
  ofl_nwk="${odir_nwk}/${fnm}"

  smru_web="smru-web@albert.grid.um.edu.mt"
  smru_ictja="/home/smru-web/cdi/resip/ictja"

  rgx="s#/media/hagbard/DS521260/##g"
  odir_smru=`echo "$dir" | sed -e $rgx`
  odir_smru="${smru_ictja}/${odir_smru}"

  ssh ${smru_web} "mkdir -p $odir_smru"
  scp $fn ${smru_web}:${odir_smru}/ 

done < /tmp/wrk
printf "\n"

What does /tmp/wrk look like? Is it a normal UNIX file for example, not some windows formatted file?

Please show the output of: file /tmp/wrk

Plus, this -- scp $fn ${smru_web}:${odir_smru}/
$fn is a directory not a file name - is that what you intend - you get the same named directory on the remote. In the output directory

$fn is the file I want to transfer

file /tmp/wrk
/tmp/wrk: ASCII text

scp /media/hagbard/DS521260/ingv/iv/hpac/hhz.d/iv.hpac..hhz.d.2016.001 smru-web@albert.grid.um.edu.mt:/home/smru-web/cdi/resip/ictja/ingv/iv/hpac/hhz.d/