pg_restore importing single table to a file
You need to read the documentation for the version you are using.
Since v12, -f - is mandatory to get output to go to stdout.  Having that behavior be obtained just by omitting -d was considered to be confusing.  But since you want the output to go to a file, just name that file:
pg_restore -Fd mydirectory -t sometable -f table.sql