It depends on your recording setup, but generally when recording any instrument with a mic, if you have an external audio interface connected to your computer, you listen to the playback of the recorded track through headphones connected to the headphone out on your audio interface and you silence your main speakers so that you can record your harmonica through a mic. You silence your main speakers for two reasons, first, so you don’t get squealing feedback, and second, so your other recorded tracks do not bleed into your harmonica track.