You need to write a new program that does what you want. It is OK to copy parts of other programs into the new code as long as
-
those parts do exactly what you want, in the correct order
-
don't conflict with any other parts of the code, especially variable names and types, and program functionality