This doesn’t look quite right to me.
To set the value you would just do this:
pm.environment.set('test-tempId', tempId);
To parse that stored variable string value to an Int, you would need to get it like this:
parseInt(pm.environment.get('tempId'));