set mySearch to "Apple"
tell application "TextWrangler"
tell window of text document "theDocName"
select last character
set myMatch to find (mySearch & tab) options {backwards:true}
if found of myMatch then
set matchLine to startLine of found object of myMatch
set myCount to contents of (last word of line matchLine)
make new line at end with data (mySearch & tab & myCount + 1)
else
make new line at end with data (mySearch & tab & 1)
end if
end tell
end tell