My code seems to get it self into infinite loops sometimes. I am new to Arduino and was wondering if it had a feature that shows you what line of code the script is running at any point in time. This would make the debugging/ fixing procedure much easier as you could see what part was making the problem.
The beta stage Arduino IDE 2.x does have an integrated debugger that can do this. However, it currently only supports certain boards (MKR Boards, Arduino Zero, Nano 33 IoT) and, with the exception of the Zero that has an integrated debugger, you also need to buy a hardware debugger probe and connect it to your Arduino board correctly.
The traditional way to do this in the Arduino world is to add Serial.println() calls to strategic places in your code and then run the program with Serial Monitor open to see what is happening.