I created a script named readfile and a test data file named testdata. Testdata contains all the data in your sample.
echo "variable 1 is: $var1"
echo "Variable 3 is: $var3"
while read var2 ; do
echo "Variable 2 is: $var2"
var3=$(expr $var2 - $var1)
echo "Variable 3 is computed as var2 - var1: $var3"
echo "Variable 1 now set to value of variable 2"
echo "Variable 1 is $var1 Variable 2 is $var2 Variable 3 is $var3"
echo "loop for more records"
echo "Read completed"
Note: I don't do testing to verify the data, I'm assuming you know how to do that. This script simply shows the process of reading the data and uses echo to display messages and values that demonstrate the process the loop is going through.
Hope this helps!