When using tinker as an external user with sudo the variable that dictates the ID of the user in Linux is not updated, so it tries to update in the directory of Tinker cache a folder that does not correspond
echo $XDG_RUNTIME_DIR
To solve it you only need to export the correct value that can be found with a echo $UID
and add it in the exposed directory found in /run/user/
export XDG_RUNTIME_DIR = /run/user/1000
This way you can write in the correct folder of the current user