A lot of concepts for intermediate level scripting class here. What you thought was straightforward and reasonable request to align the ConfirmTo is a bit of a PITA.
If we can assume there will always be a ShipTo code entered, whether it's defaulted in when the Customer is selected OR when the ShipTo code is manually changed, AND as long as the ShipTo record has the Confirm To filled in (you can have a separate script run on Pre-Write to enforce that), then you can in fact pull the Email out of AR_CustomerContact table. I've attached a button example of exactly just that (create the button on the Header panel). Life is better this way if there is always a ShipTo.
Note: What makes it work is the ConfirmTo in the Ship To is the Contact KEY not the Contact Name. However on the SO Header it's the Contact Name so you don't have the full key. Ergo you could do it an alternate way by sending the Div, Cust No to AR_CustomerContact table then set SetBrowseFilter(), then MoveFirst() then match the Contact Name string and if no match then MoveNext() all in a loop until you find it, BUT I'm hoping you can always go through the Ship To which is better.
You can look to see how I created the multi-part key to get to SO_ShipToAddress_svc and the multi-part key for AR_CustomerContact_svc. The general rule of thumb is all key segments except the last have to be null padded.
You may want to set Debug_Flag = 1 so you can see more stuff going on. Also you should view this in Notepad++ or similar so you can see the syntax highlighting and colors.
The other issue you have to deal with is the event. Since sometimes the ShipCode is defaulted in from the customer and sometimes it's selected, you need 2 scripts for both events (Post-Val of CustomerNo and Post-Val of ShipToCode). However you may just be able to use the same script for both.
Another option is tie the script to Table Pre-Write of the Header. IOW when Accept button is pressed, script fires off, gets the email, stuffs it in the order, order closes on the screen, done. Another option is to use a button script