If you are both (still) experiencing the same problem, I would also start checking for basic wiring issues: the code itself is quite simple, and very similar to what I also used (and which worked).
In particular, the fact that the problem already appears here:
int sensorVal = analogRead(sensorPin);
tells you already where to start looking at.
Is the TMP sensor really connected to pin A0 on the Arduino, as declared in the code? Are the connections done properly? (check the datasheet
- be aware that the schematic view is from the bottom).
To prove that the component itself has problem, a nice way is to substitute it with a potentiometer, as suggested by the user here above.
Hope it helps a bit