Headless laser engraving machine using arduino Mega and grbl arduino Uno

I want to engrave real time Date (in format - DD/MM/YYYY) on plastic material using ‘laser engraving’ technique. In order to do this, I need to meet the following two requirements:

  1. Build a standalone laser engraving machine without any computer - as I need to engrave Date on real time basis, I have used arduino uno with grbl for 3-axis system . I have used laser as z axis.
    I have used arduino mega with SD card, keypad and 16x4 lcd.

  2. Real time Date code engraving -
    In order to meet this requirement, I need to generate g codes on real time basis. For this purpose i am also using a keypad which can take real time dates from user , but I am wondering how to generate g codes of these real time dates entered through keypad.

Does anyone have any idea about how to generate g codes in real time without using a software, preferably through arduino mega? Or any other option to generate g code of entered real time dates keeping my set up standalone without any computer?
Or are there any instructions in G codes where I can enter only numeric data or characters?

For your reference, I am sharing a block diagram of my set up showing arduino uno with grbl and cnc shield, arduino mega with sd card-keypad-LCD.

Cheers!