func. for inserting data into table