add set cursor at the end function