User Interface, Using A buffer with a module

'receivedChars' is just a name that was convenient for the Serial Input Basics thread. If you have multiple communications paths (as you do; on the mega, PS2 and serial to Uno) you should actually rename those variables so they reflect their purpose. I usually call my receive and transmit buffers e.g. rxBufferXXX and txBufferXXX where XXX indicates the purpose.

In your Mega code, I would use rxBufferPS2 (stores characters received from keyboard) and e.g rxBufferGSM (stores characters received from Uno-GSM unit). In your Uno code, you can have a rxBufferMaster (stores characters received from the master device (Mega)) and a rxBufferGSM (stores characters received from the gsm shield).

The same applies to the flag (newData) and the functions.