I am trying to add a custom option programmatically. Below is piece of code I tried to attempt.
Problem is for my first product get updated with one custom option where as my second product gets updated with two custom options.
product 1 with one custom option.
product 2 with two custom options.

I dont know what is going wrong. Please advice how to address this issues. I am using magento 1.9.x version.
<?php
require_once 'app/Mage.php';
require_once 'Zend/Crypt/Hmac.php';
umask(0);
Mage::app('default');
Mage::getSingleton('core/session', array('name' => 'frontend'));
function getOptions(){
return array(
array(
'title' => 'Option Value 1',
'price' =>100,
'price_type' => 'fixed',
'sort_order' => '1'
),
array(
'title' => 'Option Value 2',
'price' =>100,
'price_type' => 'fixed',
'sort_order' => '1'
),
array(
'title' => 'Option Value 3',
'price' =>100,
'price_type' => 'fixed',
'sort_order' => '1'
)
);
}
$option = array(
'title' => 'custom option title',
'type' => 'radio', // could be drop_down ,checkbox , multiple
'is_require' => 1,
'sort_order' => 0,
'values' => getOptions()
);
$obj = Mage::getModel('catalog/product');
$product_id = $obj->getIdBySku('skuid1');
$product = $obj->load($product_id);
$product->setProductOptions(array($option));
$product->setCanSaveCustomOptions(true);
$product->save();
unset($product);
echo "Done";
$product_id = $obj->getIdBySku('skuid2');
$product = $obj->load($product_id);
$product->setProductOptions(array($option));
$product->setCanSaveCustomOptions(true);
$product->save();
unset($product);
echo "Done";
?>
unset($product )after the first product custom option creation