Get your taxes done using TurboTax

In fact, if I filed as 1040NR I had due, but if I filed as 1040 I got overpayment refund amount.

They imposed penalty addition to my tax due and stated a penalty as below.

Total failure-to-file

We assess a 5% monthly penalty for filing your return late for each month or part of a month the return is late, for up to 5 months. When a penalty for paying late applies for the same month, the amount of the penalty for filing late for that month is reduced by the amount of the penalty for paying late for that month. The penalty for paying late is 1/2% for each month or part of a month. We base the monthly penalty for filing late on the tax required to be shown on the return that you didn't pay by the original return due date without regard to extension. We base the monthly for paying late no the net unpaid tax at the beginning of each penalty month following the payment due date for that tax. When an income tax return is more than 60 days late, the minimum penalty is $435 or 100% of the tax required to be shown on the return that you didn't pay on time, whichever is less.