Thanks @eskimo for the reply. Thanks for confirming that pre-login agents is the way to go.
Right now the GUI app is showing up all the time at logout. How can I get it to work when only the button on the authorisation plugin is clicked? I tried WatchPaths and QueueDirectories, when the button is clicked I created a file in the WatchPath directory so the launchd launches the app only when there is a file in the directory(according to the definition of WatchPaths/QueuDirectories). But that did not help. The GUI app is showing up irrespective of the file being there or not in the WatchPath folder.