Once the old thermocouple is out you can install the new one in reverse order. Start by installing the bottom end in the same slot by pushing it into the pilot house. Then reconnect the threaded end to the control valve with your wrench.
Finally, you can relight the water heater according to the manufacturer’s instructions.