Then in the loop, create a variable to hold the string and use the function to get it.

String temperature_message = Temerature();

That absolutely will NOT work. When temperature ends, the message variable goes out of scope, which means that the memory it was using is available to be reused. Returning a pointer to that space is not a great idea.

What you do need to do is pass the function a reference to a String object that you want it to write to.

One thing that will trip you up is that the IDE fails to create function prototypes for functions that use reference arguments. You will either need to define the function before any calls to the function or create the function prototype yourself.

On the other hand, since everything else that temperature() deals with is a global variable, it doesn't really make sense to try to make it deal with local variables, too.