Your question is vague. "It doesn't work" means nothing to us. What do you expect your command to do? How does the result differ from what you desire? What did it do instead? Did you get any errors? Be precise. Nevertheless I have written an answer for you which I think comes closest to what you want.
execute command is used to execute commands from a specific entity and/or location. It has nothing to do with the removal of entities.
kill command is used to remove entities as if they are killed by natural causes. This one is not useful for slimes, because slimes split into smaller slimes when killed, unless that's what you desire. The command would be as follows:
tp command is used to teleport entities to a given location. This one is more useful for slimes, since this one takes care of all slimes in all sizes. The disadvantage is that you don't get the itemdrops if you desire those.
The command is as follows:
/tp @e[type=Slime,r=50] ~ ~-500 ~
I used -500 because the buildlimit is 256 and therefore, one cannot find a slime which gets to heights above 500 by itself.