Exploring underground is a quick and easy way to gather enough money for the merchant to move in. A lot of areas underground will have pots to break open and chests to loot. Pots are randomly generated anywhere underground.

Breaking them will grant different items, but you can commonly find money in these pots.
Surface level chests are brown chests found near the surface layer. These chests will contain around 10-29 silver.

Gather up enough silver and plan out where you want your merchant to live. Houses have specific conditions to follow in order to make valid housing for NPCs. Including the walls and the ceilings, the tiles inside the house must be at 60 total tiles. The dimensions for the house can be 5x12, 15x4, or anything in between. Of course it can be larger than this, but in order for it to count as valid housing it will need to be less than 750 total tiles.

The house above shows a 12 block high wall and 5 block long floor. The house below shows a 5 block high wall, and a 12 block long floor. Both are suitable for housing, but if you decide to go with the taller house, you will need to use a crafting table as the table rather than a regular table.
Fill in the space with walls, add a table and chair, and include at least one light source. If you have over 50 silver the merchant should move in by the next day. NPCs will only move in during the morning, so you may have to survive a night before you see the merchant move in. NPCs that are moved in will also lower the spawn rate of enemies while you are in the town. This is essential to keep yourself and your NPCs safe.