You never saved a product key. So, use CheckAndSavePKey("ABCDE-FGHI-...etc") before you call "ActivationRequestToFile()". The reason is that the activation request file contains (among other things) the product key. If you never set a product key, the activation request file cannot be generated.
Also, the return code (hr) will give you a clue as to the failure. For instance, if you call ActivationRequestToFile() without having previously set a product key using CheckAndSavePKey(), then the "hr" value will be TA_E_PKEY.
Does this make sense?