How to recover files from a Macbook that won't boot which has an SSD
There are two possibilities:
1. The SATA cable connecting your SSD to the Mac is intermittently failing. This is a common problem in MBPs of that vintage.
The good news is that this means the data itself on the drive is ok, and the internal cable just needs replacing. Alternatively, you could get an external USB enclosure (a box with a USB cable), and put the SSD in there. You may want to get a repair shop to do this.
2. The drive itself has failed in some way.
If this is case, then it is very unlikely that your data can be recovered.
Backups of data are essential to prevent data loss from drive failure. This is why macOS has Time Machine.