The sensor MUST be placed downstream of the heat input point. It DOES NOT matter what the temperature of the wort from the tun is. It only matters that you are heating the wort to your target temperature and not overheating it. Remember that the enzymes are in the wort, not the mash. If you try to control your heat input by observing the wort temperature coming out of the tun, you will likely severely overheat your wort as it passes through the heater. That will likely denature the wort enzymes and leave you with a starchy wort that does not ferment. (You don't have to ask how I learned that bone-headed lesson ;-) )
If you want to know the temperature of wort coming from the tun, insert an extra thermometer there.