konstruera data du vill skriva i en variabel och gör bara en skriv till fil. det är mycket effektivare.
$fp1 = fopen( 'obspg.txt', 'w' );
$outPut = "RETSKU\tProduct Title\tDetailed Description\tProduct Condition\tSelling Price\tAvailability\tProduct URL\tImage URL\tManufacturer Part Number\tManufacturer Name\tCategorization\tGender\tsize\tColor\n";
//retrive records from database and write to file
$result = mysqli_query($con,"SELECT * FROM `TABLE 1` ");
while($row = mysqli_fetch_array($result))
{
$outPut .= $row[`id`]."\t".$row[`title`]."\t". $row[`description`]."\t".$row[`condition`]."\t". $row[`price`]."\t".$row[`availability`]."\t".$row[`link`]."\t". $row[`image_link`]."\t".$row[`mpn`]."\t".$row[`brand`]."\t".$row[`google_product_category`]."\t".$row[`Gender`]."\t".$row[`size`]."\t".$row[`Color`]."\n";
}
fwrite( $fp1,$outPut);
fclose( $fp1 );