Your title states something different from your explanation. Do you need to add a tile or to change a tile?
Changing a tile is quite easy, you just need to get the coordinates of your mouse on a click event. With world_to_map() you can convert it to your tilemap and get the corresponding cell. You can now change the cell.
On my projects, I build my tilemap based on a dictionary (each cells has properties, like which building is on it, etc.). So I only have to get the cell coordinates, update the dictionary on the corresponding cell, and reload the map.
Adding a tile is something I have not done yet, but it seems doable : you can get_used_cells() check is the click event is on an existing cell or not. If not, you can add the cell definition in the dictionary on which you can base your tilemap for instance, and add properties.