I was struggling for long time trying to record input (microphone) and output (system sound) simultaneously until i came across the a nice youtube video explaining how to achieve this. It requires two softwares Soundflowerbed and LineIn to achieve this. Here are the links where one can download both.

https://www.macupdate.com/app/mac/11333/linein

Though LineIn tool is no more supported, it is downloadable from the above link. Now the same company that developed LineIn, made it available via another tool called SoundSource. Unfortunately, unlike LineIn, it is not free. (http://rogueamoeba.com/soundsource/)

https://rogueamoeba.com/freebies/soundflower/ (https://github.com/mattingalls/Soundflower)

Make two copies of LineIn tool and select as shown below then you are good to go.

Thanks to this youtube post.