Fan coil wiring problem with new thermostat
Not sure what model equipment you're using, but it seems like the new thermostat requires a neutral connection.   If this is the case, you'll want to make the connections as follows:
At the Thermostat

Connect the black wire to the B terminal in your diagram.
Connect the white wire to the N or neutral terminal.
Connect the red wire to the Heat (and Cool if that's how it was on the old thermostat) terminal(s).

At the Junction Box

Connect the white wire from the cable going to the thermostat,  together with the other white wires in the box.