There is an Orange Book available on Teradata's web site that explains this process in detail. It is called "Teradata Database User Defined Function User’s Guide V2R6". It is written by Mike Watzke and Floy Ivie. I would suggest that you start there and then if you have specific questions, ask them in this forum.
The best thing to do is find an example one that you'd like to try to implement and try to get that one working before embarking on writing your own. That way you'll get familiar with the process.