I typed a text onto my image in gimp. But now the dashed lines of the text box are still there. Escape button doesn't work. And then when I want to , say, draw a line on the other part of the image, I can do nothing .I can only draw inside that text box, which I do not need anymore. How can I deselect that text box so that its dashed lines disappear and I can work on the rest of the image?
The dotted yellow line is the layer boundary. It's not the text box. Also it's not a real line, just a visual guide to show you the extent of the layer.
When you export an image as JPEG/PNG etc, it won't be visible
If you don't want to see it while your are working on an image, either select another layer in the layers panel, or alternatively you can switch if off by clicking View > Show Layer Boundary which toggles it on on/off.
The "text box" is actually a "text layer". The dashed line around shows the "layer boundary" (outside of which you cannot paint, as long as this layer is the active layer).
If you want to draw a line in the image, you normally add a layer (
+ icon at the bottom of the Layers list, or
Layer ➤ New layer) and draw on that layer. Make sure when you create the layer that it has the size of the image.
You normally use the Layer list to select the layer on which you want to work (which is one reason why the Layers list is important).
Layers are fundamental in Gimp (and in other image editors). When things are on their own layer, they are easy to move around, paint in a different color, hide, duplicate... Using one single layer makes it very difficult to change your mind without undoing everything back to the point where you want something different.
You should also avoid painting on text layers, if you alter a text layer in any way that doesn't use the text tool, the layer is converted to a plain bitmap layer and you can no longer edit the text.