A man accused of murdering a fellow prisoner has been advised to seek legal representation after telling a court he killed the convicted child sex offender.