$ sed '$!N;/\
Mem/p;D' file
Amit:
Mem 30 40 50
Sumit:
Mem 50 70 80
Nishant:
Mem 90 20 45
* `$!N`: For every line that is not the last line, append the next line to the buffer with a delimiting newline in-between.
* `/\
Mem/p`: If the buffer now contains a newline character immediately followed by the string ` Mem` (two spaces and `Mem`), then print the buffer. You may also use `[[:blank:]]*` in place of the two spaces to allow for any amount of spaces or tabs at the start of the `Mem` lines.
* `D`: Delete the data in the buffer up to and including the first newline character, and start the next cycle.