Measure the span from the outside edges of the two studs at the end of the wall section. Cut a piece to fit the span if your lumber is longer than the wall section.
Place the board atop the studs so that the ends of the board are flush with the outer edges of the end studs: This is the first half of your top plate. Drive two nails through the top plate at each stud to attach the plate and hold the studs in place.
Place a second board atop the first: This is the second half of your top plate. Drive two nails through the board every 2' to attach the second board to the first.