Copied to preserve the code tags.
def program(List, Name, Detail):
for entry in List:
if entry[0] == Name:
## changed to add to the entry containing "Name" not
## entry[1] as it is [Detail, Counter] so would become
## [Detail, Counter, [Detail_2, Counter_2]]
entry.append([Detail,Counter]) ## "Counter" has not been declared
#-----------------------------------------------------------
# return=You exit the function here if the name is found,
# i.e. the following code is never reached and so is not
# the problem
#-----------------------------------------------------------
return
List.append ([Name,[Detail]])
for entry in index: ## "index" is never declared
if entry[0] == Name:
entry[1].append(Counter)