You have two options. If you are trying to use one of the Apple Silicon Macs as an external disk drive for another, you need to put the one that is going to act as the "disk" into a special mode. (On an Intel-based Mac, the mode would be called Target Disk Mode, and different directions would apply.)
Transfer files between a Mac with Apple silicon and another Mac - Apple Support
The other possibility is to treat a Thunderbolt connection between two Macs as a network link, allowing you to run TCP/IP over it and do file-sharing over it, as if it were an Ethernet link. With this method, the Mac providing access to the disk is started up normally and can be used to do other things. The other computer does not have "direct" access to the disk, but sees it only as a network (file sharing) drive.
Use IP over Thunderbolt to connect Mac computers - Apple Support