A simple way to read data in from a file is to use the 'read' command.
while read yourVar
do
some commands with $yourVar
done < yourFile
Obviously, you could nest this...
while read yourVar1
do
while read yourVar2
do
some commands with $yourVar1 $yourVar2
done < yourFile2
done < yourFile1
Alternatively, if you're trying to work with 2 files simultaneously, do something like this...
paste -d"|" file1 file2 | while IFS="|" read file1Var file2Var
do
some commands with $file1var
some commands with $file2var
done
The -d flag and the setting of IFS is just to ensure that the line read from file 2 is always $fileVar2 as the files may be different lengths.