Hi,
I have found the solution. We do not need to use such a functions like GetAncestor or others. We can insert the record directly in hierarchyid columns like
insert into tblname values ('/5/23/1/','prod name','0',getdate(),'abd',getdate(),'abd')
I have implemented this way and its working.