Well obviously it gets stuck in while(CTS) unless the CTS signaling is definitely working correctly*, and this is one of the most likely culprits. Start by removing this check.
*) for this to work, you need a 20-year old native RS232 UART port, or a very high quality advanced USB adapter, need to connect the CTS line through the MAX232 or similar level translator properly, need to configure adapter drivers / PuTTY properly, and so on. Just too many things to go wrong.
I also dislike the idea of first example being an "echo" thing because it requires both TX and RX side to work correctly in order to do anything visible. Instead, I suggest you implement a printing function and use it to print "Hello World!". On a typical UART implementation (but depends on the micro, I have never used a PIC32!), the steps to get this far usually are:
* Set the UART peripheral's config and baud rate registers,
* Configure the UART TX pin as output (connected to the correct peripheral, if that needs to be done separately)
* Enable the UART peripheral
Then,
For each character in string,
* Poll for a "transmit register empty" / similar status bit from the UART status register
* Write the byte in UART data register
Oscillosscope is great to have as you do because then you can see if anything happens on the line. Having baud rate wrong is a very common mistake to make and in an unlucky case you won't see anything, not even garbage on the computer screen, but scope easily reveals the actual baudrate.