Prime minister secures agreement during Tripoli visit aimed at boosting security and strengthening economic ties for police to probe Lockerbie bombing