Scrape out the lines between the stairway and the surrounding walls with your putty knife, getting out any pieces of plaster or other debris.
Scrub the lines vigorously with a dry brush to remove any residual dust or obstructions.
Set a caulk tube in the caulk gun. Use a utility knife to cut off the tip of the caulk tube, about 3/8 inch from the end, at a diagonal direction toward the tube. This should create a roughly 1/4-inch hole in the end of the tube.
Push a long framing nail into the hole and break the interior seal. Squeeze the trigger of the caulk gun to push the caulk up and out the end of the tip. Press the pressure-release latch at the back of the gun to stop the caulk from flowing.
Set the tip of the caulk tube to the space at the top of the first line between the stairway and the wall. Hold the gun back at a diagonal angle. Squeeze the trigger until the caulk emerges again.
Drag the gun back along the line slowly, squeezing the trigger and laying a smooth, even caulk line there. Seal the space from end to end. At the end, lift the caulk gun from the surface and press the pressure-release latch to stop the caulk.
Repeat the process for each line between the stairway and the walls. Let the caulk set for 24 hours.