On the disk. Not a partition, the disk.
When you run lilo, it retrieves the list of sectors which make up the file, and embeds them in the bootloader. At boot, the bootloader loads those sectors into RAM.
Once lilo has been run, you could rename the file and it will still be executed at boot. If you ran lilo, renamed memtestp.bin to memtestp.bak, then renamed (or hard-linked) e.g. memptestp.new to memptestp.bin without re-running lilo, the boot-loader would execute the original file, as that's the one whose sector list is embedded into the boot loader. You could even delete the file, so long as you reboot before its sectors get overwritten by something else.
The file only needs to exist in the filesystem at the point that lilo is run. Neither the bootloader nor the BIOS know anything of filesystems or partitions.