The localization of agents for collaborative tasks is crucial to maintain the quality of the communication link for successful data transmission between the base station and agents. Power-domain Non-Orthogonal Multiple Access (P-NOMA) is an emerging multiplexing technique that enables the base station to accumulate signals for different agents using the same time-frequency channel. The environment information such as distance from the base station is required at the base station to calculate communication channel gains and allocate suitable signal power to each agent. The accurate estimate of the position for power allocation of P-NOMA in a dynamic environment is challenging due to the changing location of the end-agent and shadowing. In this paper, we take advantage of the two-way Visible Light Communication (VLC) link to (1) estimate the position of the end-agent in a real-time indoor environment based on the signal power received at the base station using machine learning algorithms and (2) allocate resources using the Simplified Gain Ratio Power Allocation (S-GRPA) scheme with the look-up table method. In addition, we use the Euclidean Distance Matrix (EDM) to estimate the location of the end-agent whose signal was lost due to shadowing. The simulation results show that the machine learning algorithm is able to provide an accuracy of 0.19 m and allocate power to the agent.