Work Time attendance system

Hi I want build attendance system tracking time to work and out of work
I want to use FORM


where you can pick Name and slide checkbox IN. After work pick Name again and slide checkbox OUT.
The problem I have is how to get the OUT record in some line where the IN record is so I can make formula and calculated the time?