You can do this with 1 transaction, it will get more expensive, but it has nothing to do with whether you use separate addresses or not (or with whether or not you're using BIP32 in any way or form, for that matter).
Bitcoin uses a UTXO model: every transaction has 1 or more inputs, and one or more outputs. Every output creates a UTXO (which you can think ...
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
That error message is irrelevant.
SegWit introduced a new way of producing the hash digest for signing which requires the "amount" being spent to be included during hashing. This "amount" is the value of the output that is being spent not the amount of the new output you create. In your it is 0.02641617 or the actual value 2641617 in satoshi.
Your step 4 ...
I have summarized some popular payment types in my book "Grokking Bitcoin". There are 6 standard payment types:
p2pkh: Pay-to-public-key-hash. The public key is the second (last) item in scriptSig.
p2sh: Pay-to-script-hash. The public key(s) are packed into the redeem script which is the last item in scriptSig. To get them you need to parse the redeem ...
Does this mean that in order for me to test my segwit code, I will have to wait till I get a segwit input somehow?
Yes. You have non-segwit inputs. You cannot create a segwit transaction when your transaction has only non-segwit inputs.
To get a segwit input, just send some of your Bitcoin to a segwit address that you own.