1.You can take train number 22629 weekly on Saturday . You will reach Madurai at 00:30 in night and than catch morning passanger to Rameshwaram.(slack 5 hrs)
OR
2.take 16860 (slack 4 hr) to Coimbatore and than 16618 to Rameshwaram. Journey day can only Tuesday.
I think 2 option will be best.