1. You never compare Name : Rose with fgets'ed line because fgets appends '\n' to a line, so it looks like Name : Rose\n . Solution: use strstr instead strcmp:
if (strstr(T,B[e])) { /* T found */
...
} ... 2. You are trying to copy FUTURE lines: you don't get them yet:
strcpy(K[0],B[e-1]);
strcpy(K[1],B[e]); /* current line*/
strcpy(K[2],B[e+1]); /* you will get it on the next loop! */
strcpy(K[3],B[e+2]); /* no such line here and now */
strcpy(K[4],B[e+3]); /* - * - * - * - */ Solution: there are lots of possible and obvious variants...
3. What happens if the file contains more than 50 lines?
Solution: obvious, for example:
for (e = 0; e < 50 && fgets(...); ++e) [ /* why e ??? */ 4. scanf("%s"...) gets one word only. You can't get names like "Mary Ann" - why? Solution: use fgets(T,...,stdin) to get the name to be searched.