addElement function

Add an element to an existing grid.