Formular for straight line
y = mx + c

1 = 1(-2) + c
1 = -2 + c
c = 3
y = x + 3
Checking:
y = x + 3
When x = -2
y = -2 + 3
y = 1
Coordinates is (-2, 1)
When x = 5
y = 5 + 3
y = 8
Coordinates is (5, 8)
Both coordinates matches the question
∴ Answer is correct