How do you move an NPC's housing flag in Terraria?
You open your inventory, then over on the right side next to your armor you will see a house icon. Click on this.
You should now see a list of all your NPCs. To move them, simply select them from this list, then select a valid house in your world (you have to keep the inventory screen open). As long as the selected house is valid and unoccupied this will place their respective banner in it and they will move in.
If you house is already inhabited then you need to move the NPC occuping it first before moving a new one in. Follow the same steps to accomplish this.
To get your NPC to inhabit the selected house, simply move so that both the NPC and the house are no longer in your screen view (go a little further) and after a while if you return they will have occupied the house.