This isn't like coding a bomb to kill people, where the programmer clearly has an ethical choice.
Singh was an employee, whose bosses had the job of ensuring what they asked him to do was legal, and he was not obliged to consider the ethics or legality with full view of the "big picture" nor even know or take the "big picture" into account.
That's the bosses job, that's why they're paid more, that's why they take more risk, that's why they may end up in prison.
Even where Singh knew something was up, it wasn't his place to be a financial expert. That's what the company's senior staff are supposed to be. Even where Singh had a partial knowledge or view of the entire company/companies or the legal framework they operated in, in his role as a programmer he was not obliged to have a full view (nor could he have).
This partial view of what's going on means his decisions can not be in full consideration. It's the bosses job to make the consideration. They failed.
To judge Singh in hindsight as if he knew everything we know now, or that the courts will come to know, is bizarre.