You're using the wrong function.
the_field will echo out the content of that field, without returning anything. If you want it to return a value, you need to use get_field instead.
Try:
$twit = get_field('twitter');
WordPress has a lot of functions that have fairly similar names, and it's worth a little time reading the documentation. As a rule, functions that return a value always start with get_
.