I don't understand why you think you need to define the functions inside loop(). You can call them from loop(), but they should be defined outside of any function.
I don't understand why you think you need to define the functions inside loop(). You can call them from loop(), but they should be defined outside of any function.