British computer expert who stopped NHS cyber attack ‘admits creating malware code’