Troubleshooting SD Card Writing and ADXL345 Integration on Arduino Nano

If I interpret correctly, both the SD card module and the ADXL345 work fine by themselves, but they don't work together. If that's the case, then it sounds like you may be the victim of a circuit design flaw found in most microSD card modules. The module is supposed to release the MISO line when its CS line is not asserted so the other device can transmit on MISO. But the module doesn't do that. The solution is to solder a wire in place, and cut an existing trace. The fix is shown here:

https://forum.arduino.cc/t/gps-locator-gps-data-writing-to-sd-card/683771/2

Make sure your module looks like the one in the picture.

Edit: Sorry I didn't look at your code. It looks like you are using I2c for the ADXL. If that's the case, there should be no conflict even if MISO is not released.