How to get back all iMessages into newly installed OS X El Capitan?
Since you formatted your drive, your old messages will no longer exist on your computer. Unfortunately, iCloud does not sync iMessages with OS X as of this time. You also can't sync up using iTunes either. It's possible that you could extract them from your phone, but you wouldn't be able to simply put them back into the app again.

In the future, should you reformat, you should backup your user's library folder as this contains most customizations you have set for your apps, along with the iMessages you had before.

Even if you had made a backup, however, the structure of messages will likely change over time and I know some folks even from Yosemite were unable to simply pass these files from a backup to El Capitan.