loops within a function

I have a function where i am imputting data to the function. Within the function is a while loop reading the data put into the function. I want to put a FOR loop within the while loop but it keeps stopping the while loop on the first run. Could anyone help please.

Please post the code that you have. Also, what shell and OS are you using? Example

myFunction () {
while true
do
   for iteration in $list
   do
      echo $iteration
   done
done
}

Operatoring system AIX 5.1

example code,

function error_routine
{
while read user_id day_no month time error_file
do
USER=`grep ${user_id} $passwordfile | sed 's/:confused: /g' | awk '{ print $5,$6 }
'`

    echo "$USER created error file $error_file in $testdir on $d

ay_no $month at $time"

    for RECIPIENT in $\{MAIL_ADDRESS\}
    do
            MAIL_SUBJECT="$USER has generated an error fil

e: $error_file in $testdir on $day_no $month at $time"
pine -I^X,y -subject "${MAIL_SUBJECT}" ${RECIPIENT}
EXIT_CODE=$?
if [ ${EXIT_CODE} -ne 0 ]
then
EXIT_CODE=1
echo "There was a problem emailing the error file: $erro
f_file in $testdir generated by $USER on $day_no $month at $time to
${RECIPIENT}"
fi
done

done
}

error_routine<$OUTPUT