You will be able to draw all the edges of the graph without lifting the pen and drawing every edge exactly once (starting and ending at the same node), iff there exists an Euler circuit in the graph.
We shall use the following theorem: a connected graph has an Euler circuit iff all the nodes of the graph has even degree.
The given grid graph does not have all nodes with even degree. Let's first find the nodes with odd degrees, as shown in the next figure. Notice that the nodes B,C, E,I, H,L and N,O have odd degrees (namely 3).
Let's add 4 additional (red) edges to the grid graph as shown in the next figure to make all the nodes have even degrees.
Now, in the augmented graph above, by the theorem, it must have an Euler circuit, so we shall be able to draw all the edges of the graph exactly once without lifting the pen.
We shall use Flury's algorithm to find an Euler circuit in the augmented graph first. The key idea is that when you have a choice between a bridge and a non-bridge, always choose the non-bridge (don't burn the bridges).
Since the augmented graph has all nodes with even degrees, we can start at any node, let's start at B, a node with degree 4 in the augmented graph.
Using the algorithm, the following animation shows how to construct an Euler circuit in the augmented graph.
Now, let's find where the additional edges (ones not present in the original graph) were used in the circuit found in the augmented graph.
Let's go back to our original graph by replacing those edges by the ones in the original graph, we had exactly 4 such additional edges needed to make all nodes in the original graph to have even degrees.
It implies that in order to have the Euler circuit in the original graph we need 4 additional edges (requiring 24+4=28 edges). It also means that in the original graph we need to traverse the corresponding 4 edges twice, in order to draw all the edges without lifting the pen, as shown below:
If we don't need to start and end at the same node, it's sufficient to have an Euler trail instead of a circuit, needing one less edge: $28-1=27$ edges (only 3 edge segments, namely, EI, ON and HL are needed to be traversed twice, leading to minimum length of the line as $24+3=27$).
In this case the trail shown above starts at $B$ but ends at $C$ (instead of $B$ as before), since the edge $BC$ has already been visited once, we don't need to visit it again (as shown in the next figure).