Spotify cannot tell if you record a song. So no, it won’t get you banned. But as others have said, OSes have built in piracy protection.
With that said, it’s a terrible way to pirate songs. You can find most anything on torrents. Grab yourself some nice flac rips and encode them to a nice AAC format. Spotify uses really shitty encodes, you’re not getting lossless through them.