Do not, do not, DO NOT, try writing raw transactions at home. You will fail and you will lose a lot of money.
If you must: - Use testnet! If you don't know what testnet is, you have no business writing live raw transactions. - ALWAYS validate your transaction first by having bitcoind pretty-print it, and checking the output carefully, before sending.