First off, get rid of that stupid printTemperature() function. The loop() function doesn't ever get a temperature, so you'll never be able to use the temperature value in loop().
Create a function, with a meaningful name, that gets the temperature from the specified sensor AND returns it. Then, call that function in loop(), and you will have a temperature that can be used to diddle a relay.