help with looping

vesselNames values:
xxx
yyy
zzz
vesselPlanned values:
xxx
zzz
zzz
zzz
OIFS=""
OIFS=$IFS
IFS="\n"

for var in $vesselNames
do
        vesselNameList=`echo $var|cut -d : -f1`
        vesselNameConnectionType=`echo $var|cut -d : -f2`
        vesselNameQuantityList=`echo $var|cut -d : -f3`

if [ "$vesselNameList" != "NA" ]
        then
                if [ "$vesselNameList" = "$vesselPlanned" ]
                then
                result="$file, $carrier, $date, $vesselNameList, $vesselNameConnectionType, $vesselNameQuantityList, $vesselA
utoPlannedName, $name"
                fi
        else
                result="$file, $carrier, $date, $vesselNameList, $vesselNameConnectionType, $vesselNameQuantityList, ZZZZZ, $
vesselAutoPlannedName, $name"
        fi


echo $result
done

it suppose to loop 3 times only, however it shows this instead:

xxx
xxx
xxx
xxx
xxx
zzz
zzz
zzz
zzz
zzz
zzz
zzz

It's obvious that you're providing us partial data and a partial script, therefore it's impossible to figure out what's going on, let alone, what's going wrong.

But I'd bet you've got nested loops that are screwed up.

As Dave said, only part of coding visible. However, to see 12 outputs is not entirely crazy. You have three vessel_names and four vessel_plans : thus 3 x 4 = 12.
You showed part of how you build the three members of vessel_names, but not the vessel_plans.
If you want to debug this, insert an echo line like:

if [ "$vesselNameList" != "NA" ]
        then
                echo "$vesselNameList" "$vesselPlanned" 
                if [ "$vesselNameList" = "$vesselPlanned" ]