thre basic idea:
$result = mysql_query("SELECT book_title FROM book WHERE bible_id = '4' ORDER BY book_id ASC");
$string = '';
while ($row = mysql_fetch_assoc($result))
{
$string .= $row['book_title'] . ' COMPLETE' . "\n";
}
$string = trim($string);
$handle = fopen('/path/to/file.txt', 'w');
fwrite($handle, $string);
fclose($handle);
$result = mysql_query("UPDATE book SET book_title = CONCAT(book_title, ' COMPLETE') WHERE bible_id = '4'");