Instead of making it a line, you can use a rectangular selection. Just make a rectangular selection of any size anywhere on the image, and then edit the location on the GIMP tool tab. You will see Mode, feathered selection, anti-aliasing, and a few other things. Under those, you will see "Position" Choose the X and Y location for the start of the line, and then the X and Y size (presumably the width of the image for X, and the line thickness for Y) CHoose the paintbrush tool, select whatever color you want to use, and then just paint inside the selection. Be sure to select "Fill Whole Selection" option if you already have different colors within the selection.

If you make the grid on a separate layer, you won't muck up your original image.