There may be several misunderstandings here, so the command does not do what you perhaps expect it to.
sudo is superfluous since you don't need
sudo to read from
> some-file part is a shell redirection and thus not covered by
sudo at all. So your
sudo is super ineffective. (Note: in this particular case,
sudo might work as intended regardless, see comments. However, not using
sudo this way is a pattern as it bites you in other cases.)
Then, you're writing into a regular file. That does fill up free space - of the filesystem that file happens to reside on. If you have multiple filesystems (one for
/, one for
/home, boot and swap partitions, etc.) then those are also unaffected.
At best this only overwrites free space. There is no guarantee that it will cover everything (depends on filesystem internals, root reserve, journal, otherwise packed/reserved/etc. sectors), and it does not overwrite any file that is still there regularly (and those can include files hidden away in trashcan / thumbnail / cache folders or just some subdirectory you forgot about).
All of those will still be picked up by
photorec since it's never overwritten.
Furthermore, writing this file has to be completed first. So instead of deleting it directly afterwards, you'd have to
sync first to make sure all that random data actually hit the disk, and not just some RAM write buffer and never gets written.
So with this method, there is no guarantee for anything. At the same time it's dangerous, as the filesystem will run out of free space, which in turn can cause write failures for all other programs and thus result in unintentional data loss.