If you're trying to create a single pfx file from a public/private key pair, then I think this question becomes a duplicate of this post.
openssl pkcs12 -inkey priv.pem -in pub.cert -export -out pfx_file.pfx
As it turns out, I don't have enough reputation to comment, otherwise I would have commented on your post, vice "answering."