You will need to store the coordinates of the lines in a data structure of some sort (e.g., an array of structs). When you want to delete a line, remove it from the data structure.
Your drawing code then looks like:
- Clear buffer
- Iterate through every line, drawing it to buffer
- Draw buffer to screen
And don't call acquire/release screen. They generally aren't needed, and you'll give yourself a lot of problems if you misuse them.