Pipe sends output of first command to the standard input of second. rm does not accept standard input so you can't pipe to it. You could use xargs to achieve the same effect.
You can find example for xargs specifically for your case in man page for xargs.