What is your Core.login suppossed to do?
Core.login will create a new session for that user (which is returned from the call), not replace the one you are currently using. So your code will behave as you defined but will do effectively nothing useful as nobody knows about the session you just created.
Maybe the java action executeMicroflowAsUser from the community commons function library can point you in the desired direction?