recording from my mac

Hi everybody !

Can someone explain how I could record sounds from whats coming from my computer , I would like to sample from spotify to my sampler.
I tried routing the outputs to the inputs with cables but , its not helping .
Appreciate any help.

Thank you in aDVANCE