The problem is the code you posted doesn't just read the temperature and report it, it does loads of other stuff. After you have read the introductory tutorial write a simple function that reads the temperature and reports it in the serial monitor and does nothing else. When you get that working correctly write other functions to do the other stuff you need.
Don't forget the code tags </> when posting code.