I think you can't bring over variables from one step/script to the next one, without it being a parameter of the custom command.
If step1 actually executes and writes the info to the AD object, then $context would still have the old information that was there when the command started (I think), but you could query AD to get the new value.
Using a parameter or just doing the same UPN caluclations in step2 might be more reliable. It might be counterintuitive to re-do the logic in step2 that's already present step1, but it could be more practical anyway.