Your general idea is good, but a few details are off.
Rather than opening the file twice, once in read mode and then in append mode, you can open it once in read/write(r+) mode.
open() returns a file object, not text. So you can't just use if some_text in open(f). You must read the file.
As your data is structured line by line, the easiest solution is to use a for loop that will iterate on the lines of the file.
You can't use if name in line, because "Ben" in "Benjamin" would be True. You must check that names really are equal.
So, you could use:
name=raw_input(" Name: ")
# With Python 3, use input instead of raw_input
with open('names.txt', 'r+') as f:
# f is a file object, not text.
# The for loop iterates on its lines
for line in f:
# the line ends with a newline (\n),
# we must strip it before comparing
if name == line.strip():
print("The name is already in the file")
# we exit the for loop
break
else:
# if the for loop was exhausted, i.e. we reached the end,
# not exiting with a break, this else clause will execute.
# We are at the end of the file, so we can write the new
# name (followed by a newline) right where we are.
f.write(name + '\n')