Hi,
This is normal behavior. If there is no user context, the function will return the "administrator" value. See below the extract from the documentation:
It is only applicable in situations where there is a user context, such as when rendering an interface, displaying a report, or executing a process task form.
If there is no user context, such as when used in an expression in a node output, loggedInUser() returns "Administrator".
It highly depends what user you are trying to save in the db - is it the user that initiated a process or a user that acted on a process task? If it's the first, just use the pp!initiator parameter, if it's the second use the tp!owner parameter populated after a user task.