As you have discovered, you can’t just put the new light in parallel with the switch. The way you did this, when the switch is on, the light is shorted out and off. When the switch in on, you end up with the light in series with the outlet and, if you use a low wattage light, like an LED, the light will leak power through what you plugged in and will light.
The first thing to check is if you have a neutral wire or wires in the box with the switch. If you do, connect the light between the neutral and the switched side of the switch. (Connect to one side of the switch. If the light is not switched, switch it to the other side.)
If the is no neutral with the switch, sorry, you cannot connect your light here. You’ll have to instead connect to the outlet box. Connect the light in parallel with the outlet. Connect black to black (or red) and white to white (don’t forget the ground).
I’ve ignored details about how to connect things like pigtailing wirenuts. If you aren’t comfortable with this, get someone to help you.