Are you asking for help on how to approach the task of using a PLC to automate a process? If so, writing the program is the final step. Before you're ready to start programming, you need to do a lot of preparation such as defining the sequence of steps in your operation, determining the devices that control the process (PLC outputs)and the sensors (inputs) that tell the PLC what is happening.
Are you having trouble understanding the programming language? If so, we need to know which brand and model of PLC you're using and substantially more detail about what you're trying to do and how you're trying to do it.
There are plenty of people here willing to offer their help, but the question you've posted is too vague to expect much of a response.