Creating a custom transactions
In your script the previous ScriptPubKey is different.
If you want create custom script you need to sign manually the transaction, you can't use signrawtransactionwithkey. Bitcoin core sign only the standard transaction