"How to kill inactive transactions ?"
Do not do this.
"How to shrink logfile automatically ?"
If you are not backing up your log files, and it sounds like you are not and do not care about full recovery in the case of disaster, truncate and shrink your log file and put your database in simple recovery.
"What precautions are required to avoid my file to grow unexpectedly?"
You can swicth your recovery to bulk logged before large imports or index creation. You can also setup an alert for low disk space.
"How to use @@TRANCOUNT ?"
See book online, Transact-SQL help.
"Is setting AutoShrink TRUE on DB is safe ?"
No. Shrinking a database on a production system during the day can cause the server to slow dramatically. Shrinking a database also causes fragmentation.
If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry. Earnest Hemingway, A Farewell To Arms.