problem with loops and voids and saving outputs in a SD card

Hello, i am tying to save the analog output from a potentiometer and the signal PWM (servo) in an SD card like “.txt” or “.csv”, i have my code but it doesn’t working, i hope you can find my error. Below i attached a photo of my work.

#include <SD.h> // SD card library
#include <Servo.h> 

Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
 
int pos = 0;    // variable to store the servo position 
///int pin= 9;

//SPI SD Card pins
// MOSI = Pin 11
//MISO = Pin 12
//SCLK = Pin 13
int CS_pin=10; //ChipSelect
////int pow_pin = 8;//Pin de poder


// Entradas al Arduino desde el servo y el potenciometro
int inservo = 4 ; // entrada digital desde el servo a arduino/ input from servo to arduino
int outservo = 0 ;// entrada analoga desde potenciometro a arduino/input from potentiometer to arduino


float refresh_rate = 0.0; //Dataloger Refresh Rate
long id = 1; // Use this to store id # of our reading.

void setup ()
{
  Serial.begin(9600);
  Serial.println("Initializing Card");
  //CS is an output
  pinMode(CS_pin, OUTPUT);
  ////digitalWrite(pow_pin,HIGH);
  
  //Initialize card
  if (!SD.begin(CS_pin))
  {
    Serial.println("Card Failure");
    return;
  }
  Serial.println("Card Ready");
  
  /////Write log File Header
  File logFile = SD.open("LOG.csv",FILE_WRITE);
  if (logFile)
  {
    logFile.println(", "); // Just a leading blank line, incase tghere weas previuos data
    String header = "  Inservo  ,  Outservo  ";
    logFile.println(header);
    logFile.close();
    Serial.println(header);
  }
  else
  {
    Serial.println("Couldn't open log file");
  }
  
   myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
   pinMode(outservo,INPUT);
   pinMode(inservo,INPUT);
 
 
}

void my_loop(void)
{

while( 1 )

{
  
  //Read analog inputs and digital outputs
 
  int inservo_val = digitalRead(inservo);
  
 
  int outservo_val = analogRead(outservo);
  
  //Create Data string for storing to SD card
  // we will use the CSV Format
  String dataString= String(id) + "   ,    " + String(inservo_val) + "     ,     " + String(outservo_val);
  
  //Open a file to write to
  //Only one file can be open at time
  File logFile = SD.open("LOG.csv",FILE_WRITE);
  if (logFile)
  {
    logFile.println(dataString);
    logFile.close();
    Serial.println(dataString);
  }
  else
  {
    Serial.println("Couldn't open log file");
  }
  
  //Incremet ID number
  id++;
  
  delay(refresh_rate);


}
}

void loop()
{

  for(pos = 0; pos < 45; pos += 1)  // goes from 0 degrees to 45 degrees 
  {                                  // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
  for(pos = 45; pos>=0; pos-=1)     // goes from 45 degrees to 0 degrees 
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);     // waits 15ms for the servo to reach the position 
  } 
  for(pos = 0; pos <45; pos+=1)
  {
    myservo.write(pos);
    delay(25);
  }
   for(pos = 45; pos <90; pos+=1)
  {
    myservo.write(pos);
    delay(15);
  }
   for(pos = 90; pos >=45; pos-=1)
  {
    myservo.write(pos);
    delay(15);
  }
   for(pos = 45; pos >=0; pos-=1)
  {
    myservo.write(pos);
    delay(15);
  }
}

Thank you very much.

What is the my_loop() function for ? It is never called. Why is it there anyway ?

beacause i want 2 loops functions but i dont know if this is possible, i need tow diferent delays.

But you're not calling it. What are you trying to do? Tells us that, not how you think you ought to do it

Ok :) , I am trying to save the values PWM (which active the servo) in a SD card (module arduino SD card) like text (.txt format or .csv format) an the same way i am trying to save the analog outputs from the potentiometer. i am not good programator, so idont know if my code has sense. (sorry for my english, i hope you understand me).

I am trying to save the values PWM (which active the servo)

What value in your program is that and how often do you want to save it ? int inservo = 4 ; // entrada digital desde el servo a arduino/ input from servo to arduinoUnless you have a very special servo there is no output from a servo for the Arduino to read

an the same way i am trying to save the analog outputs from the potentiometer

I assume that this is the value that you want to save

    int outservo_val = analogRead(outservo);

But how often do you want to save it ?

It would be a good idea if you could explain exactly what you are trying to do and why.