ADXL 345 & Adafruit SD data logger_ how to merge the two working codes together?

The last post of your code has 2 setup areas and 2 loop areas. You also do Serial.begin 2 times. You can only have 1 setup and one loop. Combine all things that need setup in one area and all loop things in one area. After that we can continue to work out the issues.

Here is a Bare minimum example:

//put definitions in this area

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly: 
  
}