I did the same exercise on my OSX system, and this is my result:
$ openssl version
OpenSSL 1.0.2j 26 Sep 2016
$ openssl ec -in privkey.pem -outform DER|tail -c +8|head -c 32|xxd -p -c 32
read EC key
writing EC key
I assume that the PEM key is not in correct format, PEM follows some specific rules. There are several discussions also here in bitcoin.SE
My privkey.pem looks like this:
$ cat privkey.pem
-----BEGIN EC PRIVATE KEY-----
-----END EC PRIVATE KEY-----
This is a "test" key, note the word "Risc" in the generated bitcoin address from this key. Don't use it for any value, the funds will get lost.
If you have a test key, and really it is a test key, you can share it, and we can have a look at it (and you will then never ever use it again).