My mac would not boot so I formatted the drive and now it has no OS
When you formatted your drive, you must have been "standing" on some other boot drive ... backup (??). That said, clone its OS to your newly formatted drive. Use Carbon Copy Cloner ... the best. If you don't already have CCC, get it and install it on the drive where you "stood" to do your original formatting.