You can safely connect the Green (normally "Line Out") to the Blue (normally "Line In").
The Pink (normally "Mic") input is generally designed to handle more amplification and since line-out operates at higher levels, you would likely overdrive the signal and not be able to hear anything anyways. On a poorly-built device, this could theoretically be damaged.
Most modern sound "cards" are designed to reassign the ports using their driver software, so the potential to damage anything is extremely low as all the required circuitry necessary to adjust levels has to be available on every port.
The easiest solution is to purchase a "Y" splitter (3.5mm male -> 2 female 3.5mm) so you can keep your regular speakers plugged in to monitor.
If your sound-card has the 'What you Hear' or 'Stereo-Out' channel on your input settings, you don't need a cable at all. You can just set that as your recording input and it'll loop whatever you have back to your recording software.