This has nothing to do with shell scripting, but understanding how are set and works unix permissions...
Thread moved to more adequate forum : Beginners Q and A
You do realize that umask only has an effect when creating a new file, don't you? To change the mode of an existing file, use chmod mode file... ; not umask .
But, we know that the data you're showing us above was for a case where /tmp/temp.txt already existed and we know that your latest update to that file was not performed by the echo command you showed us. If the file had not already existed and you used the above commands, the output from ls -l would have been:
---------- 1 user1 users 6 Dec 16 10:52 /tmp/temp.txt
not:
-rwxr-xr-x 1 user1 users 23 Dec 16 10:52 /tmp/temp.txt
Just to make it explicitly clear (although implicitly alluded above): umask defines a MASK to be inverted & ANDed with the permissions supplied: the bits set in it will be turned OFF when a file is freshly created. man umask :