Draw a diagram to visualize the situation:
The displacement of an object is the change in its position between the starting point and the endpoint of the trajectory. On the other hand, the distance is the length of the trajectory of the object.
In this case, the total displacement can be calculated adding 5km+4km noting that both displacements were performed to the East. Then, the displacement is:
The total distance traveled is the same as the modulus of the displacement whenever the movement is constrained to a straight line with no changes in the direction. Then, the distance traveled is: