Try using Tilemaps, see the documentation in the editor about TileMap and TileSet to see all their methods. You can change the texture of each cell or keep the same by changing the color by modulating, deleting, collisions, etc. To detect each cell with the mouse you can use its collisions or by position proximity. For the continuity of the selection with the mouse you can use a popular algorithm:
https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
I created an empty tilemap with very small cells (4x4 pixel, no collision), and the drawing is fast.
func _process(delta):
var pos=$TileMap.world_to_map(get_local_mouse_position())
$TileMap.set_cell(pos.x, pos.y,0)
Although to avoid empty spaces you have to use the algorithm that I mentioned above or perhaps use a linear interpolation between each position of the mouse.
https://godotengine.org/asset-library/asset/111