Well the answer to question 1 would be that as you have not told us what is in $name currently and which field in your file relates to names, I would not be able
to tell you how to add surname.
As to questions 2, of course sed looks for all matches to what you have said is a $name. Should you want to match tim but not timothy you need to give sed more information
on where your word stops, ie if it delimited by the start of the line and a colon after it you can use:
Code:
name=tim
sed -i "/^$name:/d" peop.txt