Hi,
The fact that you see the product in the database but not in the backend indicates that there is a problem with the link between the category and the product.
For example, if the product is not added to a category, or is added to a non existent one, it won't display in the backend.
In your case, I guess that the problem comes from the line:
$product->categories = [1];
You use the category_id 1 which is the root category id. And when you arrive on the products listing in your backend, you're in the "product categories" category, so you're already under the root category and thus it's normal that you don't see the products directly under the root category.
You should use another id, like "2" which is the id of the "product categories" category, if you didn't modify your category tree structure too much.
For the files, you can do like that:
// add file entry to the hikashop_file table
$file = new stdClass();
$file->file_path = 'myfilename.jpg'; // make sure that your file is in the safe upload folder of HikaShop
$file->file_type= 'file';
$fileClass = hikashop_get('class.file');
$file_id = $fileClass->save($file);
$product->files= array($file_id);
$productClass->updateFiles($product,$productId,'files');
It's roughly the same process for product images.