Parsing log file and print latest number in loop

Hello All,
I have an awk script which parses my log file and prints number grepping from a specific line/pattern, now i have to come with a shell script to continue reading the log untill the job is completed, which i would know while reading session log untill process encounters a final line/statement as shown in the IF LOOP of my below shell script, encountering that line shell script should exit. so while reading this log file this awk script should be executed on the same log file to print latest number only, say my awk script output is as shown below

awk '$1 ~ "^WRITER_" {p=1;next} p&&/X_fc_Loan/{p++;next}; p==2 && NF>=6 && $6 !~/[^0-9]/{print $6;p=0}' s_GenerateXMLDataFile.log

27213
62087
62087
62090

it should print only the last number 62090, as this number keeps incrementing while job is running. Please find attached log file also.

Algorithm of the shell Script(needs to be tweaked):

#!/bin/bash

while read line
do
	for i in `awk '$1 ~ "^WRITER_" {p=1;next} p&&/X_fc_Loan/{p++;next}; p==2 && NF>=6 && $6 !~/[^0-9]/{print $6;p=0}' s_GenerateXMLDataFile.log`
	do
		echo max($i)
	done

STRING=`echo $line | awk '{print $2" "$3" "$4" "$5}'`


if [ $STRING = "TM_6020 Session [s_GenerateXMLDataFile] completed" ]
then
	exit 1
fi

done < s_GenerateXMLDataFile.log

Thank you.

Not sure I grasp what you want to tell us, but to get at the very last of your numbers, don't print $6, but assign it to a variable which then you print in the END section.