Your app should not store things in the app bundle. Bad idea. Period.
in fact, I don't, and not intend to, store anything inside the app bundle folder. as I mentioned, I want my program to be portable (such as ready-to-run on an USB drive), meaning that people unzip, and run without needing installation. I want to store the output of the program "along side" with the app, something like
AppUnzipFolder/
|-- myapp (binary)
|-- myapp.app/
| |-Contents
| |-MacOS
| |- ...
|-- Output
|- output1
as you see, I do not put my output file inside myapp.app, but I just want to find out the folder containing the app, and create an Output folder.
You should create the folder in one of the locations that macOS provides, typically under ~/Library/Application Support. Create your folder there using your app's bundle ID as the folder name.
https://developer.apple.com/library/content/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html
I did some search earlier, and found that GetUserDir or GetAppConfigDir may be an alternative, but still, making my software portable and self-contained is a feature I would love to keep.
You may be doing other things that non-Mac developers often try to drag in from the Windows or Linux worlds. A good way to root out these bad practices is just to go through the exercise of sandboxing your app. You may be surprised at how ill-disciplined your app is. But don't worry, in many cases these problems are easy to fix once you're spent a few minutes reading Apple's docs and learning about programming best practices on macOS. Here's a Pascal-oriented article on sandboxing that will help you get started:
https://macpgmr.github.io/
again, I still don't think having an installation-free and portable package design (such as USB storage based) is an "ill-disciplined" idea. I consider it as a feature, and if there are mechanisms that I can use in lazarus to keep this feature, I will be happy.