Save data for retail games are stored on the game cartridges themselves. Digital download save data is saved to the SD card.
If you do a transfer, it merges everything from the "source" 3DS and "target" 3DS onto the target 3DS (downloads, etc). The friend code and mii plaza and other social data from the source 3DS overwrites that on the target 3DS. So yes you should do a transfer, if you want to retain your friend code, friend list, and all other personal data.