int count = 0;
char **output = (char**)malloc(numLines*257);
fgets(output[count], 257, input); // here You are going wrong, with out allocating memory you are trying to read.
if you want to read string
char *output = malloc(MAX_LENGTH+1); //allocate memory
fgets(output[count], MAX_LENGTH+1, input);
if you want to read array of strings
char **output = malloc(MAX_NUM_STRINGS * sizeof(char *)); //allocate Number of pointers
for(count=0;count<MAX_NUM_STRINGS;count++)
{ output[count]=malloc(SIZE_OF_EACH_STRING+1); //allocate memory for each pointer,
//You are accessing with out allocating memory
fgets(output[count], SIZE_OF_EACH_STRING+1, input);
}