bash sed crop cut file line number

#include <stdio.h>
#include <stdlib.h>

int main() {
    FILE inputFile, outputFile;
    char line[1000];

    // Open the input file in read mode
    inputFile = fopen("input.txt", "r");
    if (inputFile == NULL) {
        perror("Error opening input file");
        return 1;
    }

    // Open the output file in write mode
    outputFile = fopen("output.txt", "w");
    if (outputFile == NULL) {
        perror("Error opening output file");
        fclose(inputFile);
        return 1;
    }

    // Loop through each line in the input file
    int lineNumber = 0;
    while (fgets(line, sizeof(line), inputFile)) {
        // Increment the line number
        lineNumber++;

        // Check if the line number is within the desired range (e.g., 5 to 10)
        if (lineNumber >= 5 && lineNumber <= 10) {
            // Use sed to remove the first 10 characters from each line
            system("echo \"$line\" | sed 's/^..........//' >> output.txt");
        }
    }

    // Close the input and output files
    fclose(inputFile);
    fclose(outputFile);

    return 0;
}