When you put a "| tee", the shell that is interpreting the script is forking a new shell for the loop. Inserting a sleep in the loop and launching the script in background gives this list of processes:
PID TTY TIME COMMAND
21168 pts/0 0:00 sh
21259 pts/0 0:00 ps
11962 pts/0 0:00 sh
21170 pts/0 0:00 sleep
21171 pts/0 0:00 tee
21169 pts/0 0:00 sh
As you can see, there is an additional shell at the end of the list. You can get the same result with this script:
STATUS=9
echo "" > /tmp/ses.txt
for SESSION in A B C
do
STATUS=5
echo "SESSION=$SESSION STATUS=$STATUS" | tee -a /tmp/ses.txt
done
echo "STATUS=$STATUS"
but whitout the side effect you are mentioning.