A prison officer who delivered intervention courses to sex offenders has been caught sending messages to a 13-year-old girl during an online sting.