Got the correct answer in applescript. Thanks to Silly-V and Loic.Aigon.
I have combined your both the scripts and putting below:
on unlockLayer(subjectLayer)
local thisSubLayer
tell application "Adobe Illustrator"
set the properties of subjectLayer to {locked:false}
if (count of layers in subjectLayer) > 0 then
repeat with i from 1 to count of layers in subjectLayer
set thisSubLayer to layer i in subjectLayer
-- set the properties of thisSubLayer to {locked:false}
my unlockLayer(thisSubLayer)
end repeat
end if
end tell
end unlockLayer
tell application "Adobe Illustrator"
local thisLayer, activeDoc
if (count of documents) > 0 then
set activeDoc to front document
repeat with i from 1 to count of layers of activeDoc
-- set the properties of layer i of front document to {locked:false}
set thisLayer to layer i of front document
-- set the properties of thisLayer to {locked:false}
my unlockLayer(thisLayer)
end repeat
end if
end tell