Ubu English is broadly correct.
"That thief was to deserve the punishment" should be "That (or prolly, the) thief deserved the punishment"
"She is to be learning English" should be, at worst, "She is to learn English"… and please note, your original "She is to be learning English" would be wholly acceptable in Indian English…
"She was to have gone to her apartment" is wholly acceptable.
"He will to have been attempting (anything)…" is wrong, because of the pointless "to".
"He will have been attempting (anything)…" is grammatically acceptable, but what did you think that actually meant?
Can you explain how that's different from "He attempted… was/had been/would have been attempting (anything)…"?