You have to look at the compiler output. It tells you where the compilation error happened. The message should also help you better understand what's wrong.
If your code compiles, but does not run correctly (it has a bug), then you can log (print messages) that indicate what the program is doing, so you can better understand how your code gets derailed.
You can also debug your Pascal program with the right tool:
https://www.google.com/search?q=how+to+debug+a+Pascal+program
You can also share your code here, so people can look into it and help you with identifying the issues.
Good luck!