In your code you didn't open the text file.
// Open the file to get existing content
$data = file_get_contents($file);
$data. = http_get("http://api.yelp.com/business_review_search?term=".$restaurant."&location=".$city."&ywsid=".$AccountKey);
// Write the contents back to the file
file_put_contents($file, $data);